Cod sursa(job #1251037)
| Utilizator | Data | 28 octombrie 2014 21:15:51 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include<stdio.h>
#include<string.h>
int main()
{
FILE *f,*g;
f=fopen("text.in", "r");
g=fopen("text.out", "a");
char x[1000010];
int a,c,nr=0,s=0,i=0;
fgets(x,1000000,f);
i=0;
c=strlen(x);
while(i<c)
{
while(!((x[i]>='a'&&x[i]<='z')||(x[i]>='A'&&x[i]<='Z')))
i++;
a=i;
while((x[i]>='a'&&x[i]<='z')||(x[i]>='A'&&x[i]<='Z'))
i++;
s=s+i-a;
nr++;
i++;
}
fprintf(g,"%d",s/nr);
fclose(f);
fclose(g);
return 0;
}
