Cod sursa(job #2134825)

Utilizator Teodor.mTeodor Marchitan Teodor.m Data 18 februarie 2018 13:00:52
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <bits/stdc++.h>
using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifndef ONLINE_JUDGE
		freopen("text.in", "r", stdin);
		freopen("text.out", "w", stdout);
	#endif
}

char sep[] = " .,;:!?-";

int main() {
	Boost();

	char text[1010];
	cin.getline(text, 1010);

	char *p = strtok(text, sep);
	int nrCuvinte = 0, nrLitere = 0;
	while(p) {
		nrCuvinte++;
		nrLitere += strlen(p);

		p = strtok(NULL, sep);
	}

	cout << (int)(nrLitere / nrCuvinte);

	return 0;
}