Cod sursa(job #2389072)

Utilizator aquarius231Zorander aquarius231 Data 26 martie 2019 19:39:09
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
	ifstream fin("text.in");
	ofstream fout("text.out");
	int length = 0;
	int words = 0;
	bool flag = false;
	char c;
	while (!fin.eof())
	{
		fin.get(c);
		if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
		{
			length++;
			if (flag == false)
			{
				flag = true;
				words++;
			}
		}
		else flag = false;
	}
	fout << length / words;
	fin.close();
	fout.close();
	return 0;
}