Cod sursa(job #53798)
Utilizator | Data | 23 aprilie 2007 13:24:37 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<stdio.h>
FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
char c;
long nrc,lt,bun;
int main() {
while(!feof(f)) {
fscanf(f,"%c",&c);
if(c>='a' && c<='z' || c>='A' && c<='Z') {
lt++; bun=1;
}
else {
if(bun==1) nrc++;
bun=0;
}
c=0;
}
fprintf(g,"%ld",lt/nrc);
fclose(f);
fclose(g);
return 0;
}