Cod sursa(job #565566)

Utilizator TeodoraTanaseTeodora Tanase TeodoraTanase Data 27 martie 2011 21:58:44
Problema Text Scor 90
Compilator cpp Status done
Runda gr_4 Marime 0.44 kb
#include <cstdio>

using namespace std;

char c;
long long lg, nr, s;

int main()
{
    freopen ("text.in","r",stdin);
    freopen ("text.out","w",stdout);
    while (!feof(stdin))
    {
        scanf ("%c",&c);
        if (c>='a' && c<='z' || c>='A' && c<='Z')
            lg++;
        else if (lg>0)
        {
            s+=lg;
            nr++;
            lg=0;
        }
    }
    printf ("%lld\n",s/nr);
    return 0;
}