Cod sursa(job #404805)
Utilizator | Data | 26 februarie 2010 18:49:03 | |
---|---|---|---|
Problema | Text | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <stdio.h>
FILE*f = fopen("text.in","r");
FILE*g = fopen("text.out","w");
char x;
int nr,s,j,i,cuv;
int main(){
while(fscanf(f,"%c",&x)!=EOF) {
if(x<'A' || x>'z'){
if(cuv==1){
nr++;
cuv=0;
}
}
if(x>='A' && x<='z'){
if(cuv==1){
s++;
} else
if(cuv==0){
cuv=1;
s++;
}
}
}
x=EOF;
if(cuv==1){
s++;
} else
if(cuv==0){
cuv=1;
s++;
}
fprintf(g,"%d",s/nr);
fclose(f);
fclose(g);
return 0;
}