Cod sursa(job #832807)

Utilizator vaneacsuVlad Neacsu vaneacsu Data 11 decembrie 2012 15:25:59
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<fstream>
using namespace std;
int main()
{
	ifstream cin("text.in");
	ofstream cout("text.out");
	char *text = new char[1050000];
	int i=0;
	while (!cin.eof())
		cin.get(text[i++]);
	text[i-1]='\0';
	int l=0, cuv=0;
	for(int start=0, stop=0; start<i-1 && stop<i-1;){
		if(('a'<=text[stop] && text[stop]<='z') || ('A'<=text[stop] && text[stop]<='Z'))
			{ stop++; l++; }
		else{
			if(start!=stop)
				cuv++;
			start=stop+1;
			stop=start; 
		}
	}
	int r = l/cuv;
	cout<<r;
	return 0;
}