Cod sursa(job #637162)
Utilizator | Data | 20 noiembrie 2011 12:30:28 | |
---|---|---|---|
Problema | PalM | Scor | 0 |
Compilator | cpp | Status | done |
Runda | .com 2011 | Marime | 0.46 kb |
#include<stdio.h>
char s[505];
int main()
{
freopen("palm.in","r",stdin);
freopen("palm.out","w",stdout);
int n,i,st,dr,lmax=1,l;
s[0]='z'+1;
i=0;
while(scanf("%c",&s[++i])!=EOF)
{
}
n=i;
s[i+1]='z'+1;
for(i=2;i<=n;i++)
{
l=1;
st=i-1;
dr=i+1;
while(s[st]<=s[st+1])
{
l++;
st--;
}
while(s[dr]<=s[dr-1])
{
l++;
dr++;
}
if(l>lmax)
lmax=l;
}
printf("%d\n",lmax);
return 0;
}