Pagini recente » Cod sursa (job #1702836) | Cod sursa (job #1622169) | Cod sursa (job #2410200) | Cod sursa (job #1262640) | Cod sursa (job #1455803)
#include <fstream>
#include <iostream>
using namespace std;
int main() {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
int words = 0;
int length = 0;
bool start_word = true;
int c = 0;
do {
c = getchar();
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
if (start_word) {
start_word = false;
words++;
}
length++;
} else {
start_word = true;
}
} while (c != EOF);
cout << length / words << endl;
}