Pagini recente » Cod sursa (job #1663881) | Cod sursa (job #714552) | Cod sursa (job #2875341) | Cod sursa (job #2041037) | Cod sursa (job #3177028)
#include <bits/stdc++.h>
#include <cctype>
#include <iterator>
#include <numeric>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("sse,avx,fma,avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
void solve() {
vector<string> collector;
string aux;
while (cin >> aux)
collector.push_back(aux);
vector<string> words;
auto parse_words = [&words](string &str) {
string curr;
for (char c : str) {
if (isalpha(c)) {
curr.push_back(c);
} else {
if (!curr.empty())
words.push_back(curr);
curr.clear();
}
}
if (!curr.empty()) {
words.push_back(curr);
}
};
for (string &w : collector)
parse_words(w);
int length =
accumulate(words.begin(), words.end(), 0,
[](int acc, string &w) -> int { return acc + w.size(); });
cout << length / words.size() << endl;
}
int main() {
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
int t = 1;
// cin >> t;
while (t--)
solve();
return 0;
}