Cod sursa(job #832751)

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