Pagini recente » Cod sursa (job #1838715) | Cod sursa (job #605954) | Cod sursa (job #3267877) | Cod sursa (job #645491) | Cod sursa (job #3153777)
#include <iostream>
#include <fstream>
#include <cctype>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
int len = 0, lentot = 0, cnt = 0;
char ch;
while ((ch = fin.get()) != EOF)
if (isalpha(ch))
len++;
else if (len > 0) {
cnt++;
lentot += len;
len = 0;
}
if (len > 0) {
cnt++;
lentot += len;
}
cout << lentot << ' ' << cnt;
fout << (cnt > 0 ? lentot/cnt : 0) << '\n';
return 0;
}