Pagini recente » Monitorul de evaluare | Borderou de evaluare (job #3121135) | Cod sursa (job #3219189) | Cod sursa (job #517409) | Cod sursa (job #2914341)
#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 (fin.get(c)) {
if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
cnt++;
} else {
len += cnt;
if (cnt > 0) {
words++;
}
cnt = 0;
}
}
if (words == 0) {
fout << "0";
return 0;
}
fout << len / words;
return 0;
}