Cod sursa(job #634319)
Utilizator | Sebastian Claici sebii_c | Data | 15 noiembrie 2011 22:12:01 |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | c | Status | done |
Runda | Arhiva de probleme | Marime | 0.41 kb |
#include <stdio.h>
#include <ctype.h>
int main()
{
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
char c;
int cWords, cTot;
cWords = cTot = 0;
c = getchar();
while (c != EOF) {
while (isalpha(c)) {
++cTot;
c = getchar();
}
while (!isalpha(c) && c != EOF) {
c = getchar();
}
if (cTot > 0)
++cWords;
}
printf("%d\n", cTot/cWords);
return 0;
}