Pagini recente » Cod sursa (job #2964519) | Cod sursa (job #1865568) | Cod sursa (job #2405161) | Cod sursa (job #338188) | Cod sursa (job #533002)
Cod sursa(job #533002)
#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;
}