Pagini recente » Cod sursa (job #2153911) | Cod sursa (job #1490126) | Cod sursa (job #798723) | Cod sursa (job #3210449) | Cod sursa (job #1484200)
#include <stdio.h>
int main (void) {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
fgets(in, MAX, stdin);
unsigned int i = 0, wlen = 0, wcount = 0;
bool inword = false;
char c;
while (scanf("%c", &c) != EOF) {
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
if (inword) {
++wlen;
} else {
inword = true;
++wlen;
++wcount;
}
} else {
inword = false;
}
}
printf("%d", (wcount) ? wlen/wcount : 0);
return 0;
}