Cod sursa(job #283860)

Utilizator yotherockerPuia Tudor yotherocker Data 20 martie 2009 10:39:15
Problema Text Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.53 kb
#include<fstream.h>
#include<string.h>
#include<ctype.h>
#include<math.h>

main()
{
	ifstream In("text.in");
	ofstream Out("text.out");

	char T[100];
	unsigned int i=0,c=0,cuvinte=0,ok=0,rez=0;

	In.get(T,100);
	c=strlen(T);

	In.close();

	int* Tb=new int[c];

	for(i=0;i<c;i++)
	{
		if(isalpha(T[i])) Tb[i]=1;
		else Tb[i]=0;
	}

	for(i=0;i<c;i++)
	{
		if(!ok && Tb[i]) ok=1;
		if(ok && Tb[i] && !Tb[i-1]) cuvinte++;
	}

	rez=abs(c/cuvinte);

	Out<<rez<<'\n';
	Out.close();
	delete[] Tb;
	return 0;

}