Cod sursa(job #53793)
Utilizator | Data | 23 aprilie 2007 13:17:34 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include<stdio.h>
FILE *f=fopen("text.in","r"), *g=fopen("text.out","w");
char c;
long nrc,lt,bun;
int main() {
while(fscanf(f,"%c",&c)==1) {
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;
}