Pagini recente » Cod sursa (job #573087) | Diferente pentru documentatie/textile intre reviziile 102 si 103 | Monitorul de evaluare | Cod sursa (job #1098548) | Cod sursa (job #2914340)
#include <fstream>
#include <cctype>
using namespace std;
int main() {
ifstream fin("text.in");
ofstream fout("text.out");
char c;
int cnt = 0, len = 0, words = 0;
while ((c = fin.get()) != '\n') {
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
cnt++;
} else {
len += cnt;
if (cnt > 0) {
words++;
}
cnt = 0;
}
}
fout << len / words;
return 0;
}