Cod sursa(job #884830)
Utilizator | Data | 21 februarie 2013 13:06:56 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<stdio.h>
char c;
int x[1100000],i=1,ok=0,s=0;
int main()
{
freopen("text.in","r",stdin);
freopen("text.out","w",stdout);
while(scanf("%c",&c)==1)
{
if(((c>='a')&&(c<='z'))||((c>='A')&&(c<='Z')))
{
++x[i];
ok=1;
}
else if(ok==1)
{
s=s+x[i];
++i;
ok=0;
}
}
if(i==1)
printf("%d",x[1]);
else
printf("%d",s/(i-1));
return 0;
}