Cod sursa(job #1455803)

Utilizator paulhermanPaul Herman paulherman Data 29 iunie 2015 08:17:31
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#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;
}