Cod sursa(job #159375)
Utilizator | Lala Marius Ionut Ionutz_Lala | Data | 14 martie 2008 08:51:50 |
---|---|---|---|
Problema | Text | Scor | 80 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
#include<string.h>
FILE *f=fopen("text.in","r"),*g=fopen("text.out","w");
int main()
{
char str[100000];
int w;
long int ncu=0,nch=0,l,i;
while(!feof(f))
{
fscanf(f,"%s",str);
l=strlen(str);
w=0;
for(i=0;i<l;i++)
if((64<str[i]&&str[i]<91)||(96<str[i]&&str[i]<123))
{
if(!w) {w=1;ncu++;}
nch++;
}
else w=0;
}
fprintf(g,"%ld",nch/ncu);
return 0;
}