Cod sursa(job #26994)
| Utilizator | Data | 5 martie 2007 23:17:17 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <stdio.h>
#include <string.h>
int main(){
FILE *f1,*f2;
f1=fopen("text.in","r");
f2=fopen("text.out","w");
long len,cuv,k;
char ch;
len=0;
cuv=0;
k=0;
while(fscanf(f1,"%c", &ch)!=EOF){
if (('a'<=ch&&ch<='z')||('A'<=ch&&ch<='Z')){
len++;
if (!k)cuv++;
k=1;
}
else k=0;
}
len=len/cuv;
fprintf(f2,"%ld\n",len);
fclose(f1);
fclose(f2);
return 0;
}
