Cod sursa(job #2202374)

Utilizator apuscasuPuscasu Ana Maria apuscasu Data 8 mai 2018 17:07:20
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
using namespace std;

char text[300009];

int nr, nrc;
bool vf;

int main()
{
	ifstream fin("text.in");
	ofstream fout("text.out");
	while (fin >> text)
	{
		for (int i = 0; i<strlen(text); ++i)
		{
			if (isalpha(text[i]))
			{
				nr++;
				vf = 1;
			}
			else
			{
				if (vf)
				{
					nrc++;
					vf = 0;
				}
			}
		}
		if (vf)
		{
			nrc++;
			vf = 0;
		}
	}
	fout << nr / nrc;
}