Cod sursa(job #2898072)
Utilizator | Ionescu Rares-Andrei RaresIonescu | Data | 5 mai 2022 21:49:10 |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main()
{
char *cuvant, sir[100];
int lgmax = 0, nrcuv = 0;
fin.getline(sir,100);
cuvant = strtok(sir, " ");
while(cuvant)
{
for(int i = 0; i < strlen(cuvant); i ++)
{
if((cuvant[i] >= 'A' && cuvant[i] <= 'Z') || (cuvant[i] >= 'a' && cuvant[i] <= 'z'))
lgmax ++;
}
nrcuv ++;
cuvant = strtok(NULL, " ");
}
fout << lgmax / nrcuv;
return 0;
}