Cod sursa(job #1780842)

Utilizator alexandra_moldovanMoldovan Alexandra alexandra_moldovan Data 16 octombrie 2016 16:17:27
Problema Text Scor 100
Compilator cpp Status done
Runda simulare_emag_mediu_2016_runda1 Marime 0.49 kb
#include<fstream>
#include<iostream>
#include<cstring>
using namespace std;
int nrLit=0, nrCuv=0,ok=0;
char c,ant=0;

fstream fin("text.in",ios::in);
fstream fout("text.out",ios::out);

int main()
{
	while(fin>>noskipws>>c)
	{
		if('a'<=c && c<='z' || 'A'<=c && c<='Z')
		{
			nrLit++;
			ok=1;
		}
		else
		{
			if(ok==1)
			{
				nrCuv++;
				ok=0;
			}
		}
	}
	if(ok==1)
	{
		nrCuv++;
		ok=0;
	}	
	fout<<nrLit/nrCuv;
	fin.close();
	fout.close();
	return 0;
}