Cod sursa(job #244576)

Utilizator AthanaricCirith Gorgor Athanaric Data 15 ianuarie 2009 15:25:10
Problema Rj Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.84 kb
#include <stdio.h>
#define S 20050
char x[S],s[S];
int n,k,max,imax,jmax;
void Read()
{
	while (scanf("%c",&x[++n])!=EOF);
}
void NoCase()
{
	for (int i=1; i<=n; i++)
	{
		if ('a'<=x[i]&&x[i]<='z')
			s[++k]='A'+x[i]-'a';
		else
			s[++k]=x[i];
	}
}
void Print()
{
	for (int i=1; i<=k; i++)
		printf("%c",s[i]);
}
bool litera(char x)
{
	if ('A'<=x&&x<='Z')
		return true;
	return false;
}
void CraniumBasher()
{
	int i,j,poz;
	for (poz=1; poz<=k; poz++)
	{
		i=poz-1; j=poz+1;
		while (s[i]==s[j])
		{
			while (i>0&&!litera(s[i]))
				i--;
			while (j<k&&!litera(s[j]))
				j++;
		}
		if (j-i+1>max)
		{
			imax=i;
			jmax=j;
			max=j-i+1;
		}
	}
}
void Solve()
{
	Read();
	NoCase();
	CraniumBasher();
}
int main()
{
	freopen("calfflac.in","r",stdin);
	freopen("calfflac.out","w",stdout);
	Solve();
}