Cod sursa(job #809366)

Utilizator a96tudorAvram Tudor a96tudor Data 8 noiembrie 2012 10:28:48
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 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;
    long long s=0,n=0,nr=0;
    while (x!='\n')
    {
        scanf("%c",&x);
        if (litera(x)) nr++;
                else {s+=nr;
                      if (nr!=0) n++;
                      nr=0;
                        }

    }
    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;
}