Cod sursa(job #2672045)
| Utilizator | Data | 12 noiembrie 2020 23:08:16 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
const int NMAX = 1e7;
char s[NMAX];
int main() {
int sum = 0, cnt = 0;
while(fin.getline(s, sizeof(s))) {
int N = strlen(s);
for(int i = 0; i < N; ++i)
if(isalpha(s[i])) {
int j = i;
while(isalpha(s[j]) && j < N)
++j;
sum += j - i;
++cnt;
i = j;
}
}
if(cnt == 0)
fout << 0;
else
fout << sum / cnt;
}
