Cod sursa(job #2052816)

Utilizator trifangrobertRobert Trifan trifangrobert Data 31 octombrie 2017 01:31:45
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <fstream>
#define DIM 1100000

using namespace std;

char x;
int sum = 0, cnt = 0;
bool ok = false;

inline bool CheckLetter(char x)
{
	return ('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z');
}

int main()
{
	ifstream fin("text.in");
	while (fin.get(x))
	{
		if (CheckLetter(x))
		{
			++sum;
			if (ok == false)
			{
				ok = true;
				++cnt;
			}
		}
		else
			ok = false;
	}
	fin.close();
	ofstream fout("text.out");
	fout << sum / cnt << "\n";
	fout.close();
	return 0;
}