Cod sursa(job #3040069)

Utilizator amcbnCiobanu Andrei Mihai amcbn Data 29 martie 2023 12:02:18
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
/// [A][M][C][B][N] ///
#include <bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string str;
	getline(fin, str);
	for (auto& c : str) {
		if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))) {
			c = ' ';
		}
	}
	stringstream ss(str);
	int cnt = 0, len = 0;
	while (ss >> str) {
		cnt++, len += str.size();
	}
	fout << len / cnt;
}