Cod sursa(job #823279)

Utilizator antonioteoZait Teodor Antonio antonioteo Data 24 noiembrie 2012 20:52:48
Problema Text Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <cstring>
using namespace std;
//const char iname[] = "text.in";
//const char oname[] = "text.out";
//ifstream fin(iname);
//ofstream fout(oname);
ifstream fin("text.in");
ofstream fout("text.out");
char s[ 10000000 ] , x;
long long lg , i , j , lgt , nr_cuv , lgt2;
long long VeritaSerum ()
{
	for ( i = 0; i < lg; ++i )
	{
		if ( s[ i ] >= 'a' && s[ i ] <= 'z' )
		{
			while ( s[ i ] >= 'a' && s[ i ] <= 'z' )
			{
				++lgt; ++lgt2;
				++i;
			}
			if ( lgt2 > 1 ) 
				++nr_cuv;
			lgt2 = 0;
		}
	}
	long long vs = lgt / nr_cuv;
	return vs;
}
int main()
{
	fin.get ( s , 9999999 );
	lg = strlen ( s );
	fout << VeritaSerum () << '\n';
	return 0;
}