Cod sursa(job #1300553)

Utilizator wGEORGEWGeorge Cioti wGEORGEW Data 24 decembrie 2014 16:14:12
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <cstdio>
#include <cstring>
#include <cctype>
using namespace std;
 
int TotalLen, CntWords, CurrentLen, L;
char C[1100000];
 
int main()
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);
 
    gets(C);
    L = strlen(C);
    for(int i = 1; i <= L; ++ i)
    {
        if(isupper(C[i]) || islower(C[i])) CurrentLen ++;
        else
        {
            if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
            CurrentLen = 0;
        }
    }
 
    if(CurrentLen) TotalLen += CurrentLen, CntWords ++;
 
    printf("%i\n", TotalLen / CntWords);
}