Yet Another Palindrome
Robbert van Renesse
cogito at cs.vu.nl
Tue Jan 6 03:07:46 AEST 1987
Unlike Dan Hoey I don't think that relying on ASCII makes a program non-
portable. I've used an idea of his to make an ever shorter palindrome.
It consists of two lines, of which the first one is empty. For mailing
purposes, I've folded the long line. There IS a newline at the end of
the program (for portability). It is possible to make the program smaller
by eliminating that newline. This one is 307 bytes.
--------8<----------------8<----------------8<----------------8<--------
/**/char*p="*/char*p=/*/};)e(stup;43=b*;)041,p(a;)1,q(a;)9,p(a;)2,9+p(a
{)(niam};++s* =--b* =f++*)--n(elihw{;s*rahc)n,s(a;43=][q,503+e=b*,e=f*,
01=]666[e,",e[666]=10,*f=e,*b=e+305,q[]=34;a(s,n)char*s;{while(n--)*++f
= *b--= *s++;}main(){a(p+9,2);a(p,9);a(q,1);a(p,140);*b=34;puts(e);}/*/
=p*rahc/*"=p*rahc/**/
--------8<----------------8<----------------8<----------------8<--------
(By the way, the shortest palindrome that I could come up with, is:
/**/main(){}/*/}{)(niam/**/
Robbert van Renesse
Vrije Universiteit
Amsterdam
More information about the Comp.lang.c
mailing list