Cod sursa(job #3153771)
| Utilizator | Data | 1 octombrie 2023 11:22:43 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <iostream>
#include <fstream>
#include <cctype>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int main() {
string line;
getline(fin, line);
int len = 0, lentot = 0, cnt = 0;
for (char ch: line)
if (isalpha(ch))
len++;
else if (len > 0) {
cnt++;
lentot += len;
len = 0;
}
if (len > 0) {
cnt++;
lentot += len;
}
fout << lentot/cnt << '\n';
return 0;
}