Cod sursa(job #533001)
| Utilizator | Data | 12 februarie 2011 21:03:51 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <cstdio>
#include <cctype>
#define MAX 1024*1024
int main(){
char T[MAX+100];
int c, wlength, wcount, i;
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
c = fread(T, sizeof(char), MAX+100, stdin);
wcount=1;
for(i=0; i<c; i++){
if(T[i]==' ')
wcount++;
else if(isalpha(T[i]))
wlength++;
}
printf("%d\n", wlength/wcount);
return 0;
}
