Cod sursa(job #2909288)

Utilizator june122022Alexandru Mihai june122022 Data 12 iunie 2022 11:53:03
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("text.in");
ofstream fout("text.out");

int main(void) {
	string s;
	getline(fin, s);
	int cuvinte = 0, l = 0, lmax = 0;
	for(int i=0; i<s.length(); i++) {
		if((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')) {
			l++;
		}
		else {
			if(l != 0) {
				lmax += l;
				cuvinte++;
				l = 0;
			}
		}
	}
	fout << lmax / cuvinte << '\n';
	return 0;
}