Cod sursa(job #732080)

Utilizator vladstoickvladstoick vladstoick Data 9 aprilie 2012 17:36:10
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include<stdio.h>
using namespace std;
//ifstream in("text.in");
//ofstream out("text.out");
char c;
int secv, nrCuv,suma;
bool litera(char a)
{
    if(a>='a'&& a<='z')
        return true;
    if(a>='A'&&a<='Z')
        return true;
    return false;
}
int main()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
    while(scanf("%c",&c)!=EOF)
    {
        if(litera(c)==true)
            secv++;
        else
        {
            nrCuv+=(secv!=0);
            suma=suma+secv;
            secv=0;
        }
    }
   printf("%d",suma/nrCuv);
   return 0;
}