Cod sursa(job #2278955)

Utilizator Code_SniperNetoiu Mihail Code_Sniper Data 8 noiembrie 2018 19:07:11
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.53 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	char text[10];
	long i = 0, y = 0, cuv = 0, lit = 0;

	ifstream f("text.in");
	ofstream g("text.out");


	while (f)
	{
		text[i % 10] = f.get();
		if ((text[i % 10] >= 'A' && text[i % 10] <= 'Z' ) || (text[i % 10] >= 'a' && text[i % 10] <= 'z'))
			y++;
		else if (y != 0)
		{
			cout << y<<' ';
			cuv++;
			lit += y;
			y = 0;
		}
		i++;
	}
	if (y != 0) {
		cuv++;
		lit += y;
	}


	g << lit / cuv;

	f.close();
	g.close();
}