Pagini recente » Cod sursa (job #304167) | Cod sursa (job #2944802) | Cod sursa (job #1623576) | Cod sursa (job #812260) | Cod sursa (job #1484201)
#include <stdio.h>
int main (void) {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
unsigned int 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;
}