Longest Palindrome by bk1e

char s[999];main(a,i,l,m){for(;gets(s);){for(l=m=strlen(s);;--l)for(i=0;i+l<=m;++i){for(a=0;a<l/2;++a)if(s[i+a]!=s[i+l-a-1])goto z;s[i+l]=0;puts(s+i);goto w;z:;}w:;}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page