Pagini recente » Cod sursa (job #3157060) | Cod sursa (job #1652542) | Cod sursa (job #2876195) | Cod sursa (job #1094171) | Cod sursa (job #2309558)
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'
using namespace std;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef long long ll;
typedef unsigned long long ull;
ifstream f ("text.in");
ofstream g ("text.out");
bool isAlpha (char c) {
return (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'));
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
#ifdef LOCAL_DEFINE
freopen (".in", "r", stdin);
#endif
char c;
int pos = 0;
int num_words = 0;
int total_len = 0;
f >> noskipws;
while (!f.eof()) {
f >> c;
if (!isAlpha (c)) {
continue;
}
if (f.eof()) break;
int len = 0;
while (!f.eof() && isAlpha (c)) {
++len;
f >> c;
}
total_len += len;
++num_words;
}
g << total_len / num_words << '\n';
f.close();
g.close();
return 0;
}