Cod sursa(job #1198070)

Utilizator auRSTARHreapca Aurelian auRSTAR Data 14 iunie 2014 14:20:47
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include<cstdio>
#include<cstring>
using namespace std;
int letters,words;
char S[10000010],*p;

bool isLetter(char C)
{
    if(C>='a' && C<='z')return true;
    if(C>='A' && C<='Z')return true;
    return false;
}

int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    fgets(S,10000010,stdin);
    for(p = S; *p; p++)
    {
        if(isLetter(*p))letters++;
        if(p==S)continue;
        if(isLetter(*p) && !isLetter(*(p-1)))words++;
    }
    printf("%d\n",letters/words);
    return 0;
}