Cod sursa(job #227817)
| Utilizator | Data | 5 decembrie 2008 16:43:31 | |
|---|---|---|---|
| Problema | Text | Scor | 90 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <stdio.h>
int main()
{
FILE *in = fopen("text.in","r");
FILE *out = fopen("text.out","w");
char c;
long long s=0,nr=0,a=-1,b=1;
while (!feof(in))
{
fscanf(in,"%c",&c);
if (('a'<=c && c<='z') || ('A'<=c && c<='Z'))
{
if (a==-1) a=0;
else b++;
}
else
{
if (a!=-1)
{
s = s + b;
nr++;
}
a=-1;
b=1;
}
}
fprintf(out,"%d",s/nr);
}
