Cod sursa(job #638387)
| Utilizator | Data | 20 noiembrie 2011 20:45:39 | |
|---|---|---|---|
| Problema | PalM | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | .com 2011 | Marime | 0.52 kb |
#include <cstdio>
#include <cstring>
using namespace std;
char s[550];
int main()
{
int N;
freopen("palm.in","r",stdin);
freopen("palm.out","w",stdout);
fgets(s,550,stdin);
N=strlen(s);
int w,x=1;
for(int i=0;i<N;++i)
{
w=0;
int j=1;
while((s[i-j]==s[i+j])&&(i-j>=0)&&(i+j<N)&&(s[i-j]<=s[i-j+1]))
{
++j;
++w;
}
if(w*2+1>x) x=w*2+1;
}
x=1;
printf("%d\n",x);
return 0;
}
