Cod sursa(job #404731)
| Utilizator | Data | 26 februarie 2010 16:57:30 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<stdio.h>
#include<string.h>
char x,y;
int cuv,lit,ok;
int main(){
FILE * f = fopen("text.in","r");
FILE * g = fopen("text.out","w");
while(fscanf(f,"%c",&x)!=EOF){
if(('a'<=x&& x<='z')||('A'<=x && x<='Z')){
lit++;
ok=1;
}
else{
if(ok==1)
cuv++;
ok=0;
}
y=x;
}
if(('a'<=x&& x<='z')||('A'<=x && x<='Z'))
cuv++;
fprintf(g,"%d",lit/cuv);
fclose(f);
fclose(g);
return 0;
}
