Cod sursa(job #2192804)

Utilizator NGMihaiNeamt Mihai NGMihai Data 7 aprilie 2018 12:58:30
Problema Text Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>
#include <iostream>
#include <string.h>

std::ifstream fin("text.in");
std::ofstream fout("text.out");

int differentC(char cuvant[1000])
{
	int count = 0;
	for (unsigned i = 0; i < strlen(cuvant); i++) 
	{
		if ((cuvant[i] >= 'a' && cuvant[i] <= 'z') || (cuvant[i] >= 'A' && cuvant[i] <= 'Z'))
		{
			count++;
		}
	}
	return count;
}

int main()
{
	char cuvant[1000];
	int nrTotalCaractere = 0;
	int nrCuvinte = 0;

	while (fin >> cuvant) {
		nrTotalCaractere += differentC(cuvant);
		nrCuvinte++;
	}
	fout << nrTotalCaractere / nrCuvinte << "\n";
	return 0;
}