Cod sursa(job #638066)
Utilizator | Hreapca Aurelian auRSTAR | Data | 20 noiembrie 2011 18:35:46 |
---|---|---|---|
Problema | PalM | Scor | 0 |
Compilator | cpp | Status | done |
Runda | .com 2011 | Marime | 0.48 kb |
#include<cstdio>
#include<cstring>
void read(),solve();
char A[510];
int len,i,st,dr,sol;
int main()
{
read();
solve();
return 0;
}
void read()
{
freopen("palm.in","r",stdin);
freopen("palm.out","w",stdout);
scanf("%s",A+1);
}
void solve()
{
len=strlen(A+1);
for(i=2;i<len;i++)
{
for(st=i-1,dr=i+1;st>=1&&dr<=len;st--,dr++)
if(!(A[st]==A[dr]&&A[st]<=A[st+1]&&A[dr]<=A[dr-1])){st++;dr--;break;}
if(sol<dr-st+1)sol=dr-st+1;
}
printf("%d\n",sol);
}