Pagini recente » Cod sursa (job #3215508) | Cod sursa (job #2184103) | Cod sursa (job #707329) | Cod sursa (job #3175350) | Cod sursa (job #2309556)
#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");
const int NMAX = 1100000;
int n;
char s[NMAX];
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
f.getline (s, NMAX);
int n = strlen (s);
int pos = 0;
int num_words = 0;
int total_len = 0;
while (pos < n) {
while (pos < n && !isAlpha (s[pos])) {
++pos;
}
if (pos == n) break;
int len = 0;
while (pos < n && isAlpha (s[pos])) {
++pos;
++len;
}
total_len += len;
++num_words;
}
g << total_len / num_words << '\n';
f.close();
g.close();
return 0;
}