Pagini recente » Cod sursa (job #1685219) | Cod sursa (job #906946) | Cod sursa (job #2431) | Rating Irimescu Stefan (wscsprint3r) | 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;
}