Cod sursa(job #329821)
Utilizator | Data | 7 iulie 2009 18:24:16 | |
---|---|---|---|
Problema | Text | Scor | 90 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <stdio.h>
FILE *f,*g;
char c;
int ok;
long s,n;
int main(){
f=fopen("text.in","r");
g=fopen("text.out","w");
while (!feof(f)){
fscanf(f,"%c",&c);
if (65<=c&&c<=90||97<=c&&c<=122){
ok=1;
n++;
}
else
if (ok==1){
ok=0;
s++;
}
}
if (65<=c&&c<=90||97<=c&&c<=122) n++;
fprintf(g,"%ld\n",n/s);
fclose(f);
fclose(g);
}