Cod sursa(job #1477613)

Utilizator akaprosAna Kapros akapros Data 26 august 2015 16:33:26
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<cstdio>
#include<algorithm>
#include<cstring>
int l, nrc;
bool ok;
char s;
int main()
{
    freopen("text.in", "r", stdin);
    freopen("text.out", "w", stdout);

    while ( scanf("%c", &s) != EOF )
    {
        if (s == '\n') break;
        if (( s <= 'Z' && s >= 'A' ) || ( s <= 'z' && s >= 'a' ))
        {
            l++;
            if (!ok)
                ++ nrc;
            ok = 1;
        }
        else
           ok = 0;
    }
    printf("%d", l / nrc);
    return 0;
}