Cod sursa(job #533002)
| Utilizator | Data | 12 februarie 2011 21:04:54 | |
|---|---|---|---|
| Problema | Text | Scor | 50 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 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=0; wlength=0;
for(i=0; i<c; i++){
if(T[i]==' ')
wcount++;
else if(isalpha(T[i]))
wlength++;
}
if(wlength!=0)
wcount++;
printf("%d\n", wlength/wcount);
return 0;
}
