Pagini recente » Cod sursa (job #2372958) | Cod sursa (job #99754) | Cod sursa (job #2593787) | Cod sursa (job #1743124) | Cod sursa (job #2372328)
#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
char c;
int num_of_words = 0;
int total_word_length = 0;
int current_word_length = 0;
while (cin.get(c)) {
if (!isalpha(c)) {
if (current_word_length) {
num_of_words++;
total_word_length += current_word_length;
}
current_word_length = 0;
} else {
current_word_length++;
}
}
cout << total_word_length / num_of_words;
}