Cod sursa(job #809370)

Utilizator a96tudorAvram Tudor a96tudor Data 8 noiembrie 2012 10:38:07
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.82 kb
#include<cstdio>
#include<cstring>
using namespace std;
inline bool litera(char x)
{
    if ((x>=97 && x<=122) || (x>=65 && x<=90)) return true;
            else return false;
}
inline void citire()
{
    char x,y;
    long long s=0,n=0,nr=0;

    while (x!='\n')
    {
        scanf("%c",&x);
        if (litera(x)) nr++;
                else {
                      if (litera(y)) {
                                        s+=nr;
                                        if (nr!=0) n++;
                                        nr=0;
                                    }
                    }
    y=x;
    }
    printf("%lld",(int)s/n);
    return;
}
int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    citire();
    fclose(stdin);
    fclose(stdout);
    return 0;
}