Cod sursa(job #3272994)
| Utilizator | Data | 31 ianuarie 2025 22:22:12 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <bits/stdc++.h>
#include <regex>
using namespace std;
ifstream in("text.in");
ofstream out("text.out");
int main() {
int length = 0, count = 0;
const regex r("[a-zA-Z]+");
string s;
while (getline(in, s)) {
for (auto it = sregex_iterator(s.begin(), s.end(), r); it != sregex_iterator(); it++) {
length += it->str().size();
count++;
}
}
if (count == 0) out << 0;
else out << length / count;
return 0;
}
