Cod sursa(job #823305)

Utilizator antonioteoZait Teodor Antonio antonioteo Data 24 noiembrie 2012 21:20:35
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 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;
int lg , i , j , lgt , nr_cuv , vs , verita = 1;
void VeritaSerum ()
{
	for ( i = 0; i < lg; ++i )
	{
		if ( ( s[ i ] >= 'a' && s[ i ] <= 'z' ) || ( s[ i ] >= 'A' && s[ i ] <= 'Z' ) )
		{
			++lgt;
			if ( verita )
			{
				++nr_cuv;
				verita = 0;
			}
		}
		else
			verita = 1;
	}
	if ( nr_cuv ) 
		vs = lgt / nr_cuv;
	else 
		vs = 0;
}
int main()
{
	fin.get ( s , 99999999 );
	lg = strlen ( s );
	VeritaSerum ();
	fout << vs << '\n';
	return 0;
}