Cod sursa(job #602397)

Utilizator DevilShadowJunc Raul Cosmin DevilShadow Data 11 iulie 2011 12:37:45
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <iostream>
#include <fstream>

using namespace std;

char s[200000001];
int main()
{
	ifstream f("text.in");
	ofstream g("text.out");
	
	int contor_char = 0;
	int contor_word = 0;
	int lenght;
	
	f.get(s, 200000000);
	
	lenght = strlen(s);
	
	for(int i = 0; i < lenght; i ++)
	{
		if((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
		{
			contor_char ++;
			if(!((s[i + 1] >= 'a' && s[i + 1] <= 'z') || (s[i + 1] >= 'A' && s[i + 1] <= 'Z')))
				contor_word ++;
		}
		
	}
	g << contor_char / contor_word;
	f.close();
	g.close();
}