Cod sursa(job #1566234)
Utilizator | Data | 11 ianuarie 2016 21:37:05 | |
---|---|---|---|
Problema | Text | Scor | 70 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <cstdio>
#include <cctype>
using namespace std;
int main() {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
int nr, sum;
char ch;
bool newWord;
nr = sum = 0;
do {
ch = getchar();
if(isalpha(ch)) {
sum++;
if(newWord) {
nr++;
newWord = 0;
}
}
else {
newWord = 1;
}
} while(ch != EOF);
printf("%d\n", sum / nr);
return 0;
}