Pagini recente » Cod sursa (job #1311109) | Cod sursa (job #570922) | Cod sursa (job #61361) | Cod sursa (job #1409187) | 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;
}