home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!asuvax!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
- From: dave@cs.arizona.edu (Dave Schaumann)
- Newsgroups: comp.lang.c
- Subject: Re: C palindrome puzzle: a solution
- Message-ID: <1993Jan6.214531.3364@organpipe.uug.arizona.edu>
- Date: 6 Jan 93 21:45:31 GMT
- References: <C0DuoE.7M8@sci.kun.nl>
- Sender: news@organpipe.uug.arizona.edu
- Reply-To: dave@cs.arizona.edu (Dave Schaumann)
- Organization: University of Arizona
- Lines: 40
- In-Reply-To: ronny@cs.kun.nl (Ron Wichers Schreur)
-
- [the rules: write a C program that's a palendrome and prints out "hello, world"
-
- In article <C0DuoE.7M8@sci.kun.nl>, ronny@cs (Ron Wichers Schreur) writes:
- >I'll only post the second half of my program:
- >
- > ab(( b enifed#
- > cd enifed#
- > cb bc enifed#
- > ;dc int enifed#
- > diov main enifed#
- > niam tni void enifed#
- > };0 nruter;dc"dlrow olleh"cb stup{
- > ) dc enifed#
- > )diov cb niam tni
- > ab( cb enifed#
- > >h.oidts<edulcni#
- > ab enifed#
- > )ab(ba enifed#
- > ;)diov(niam tni
- >
- >It must be possible to find a shorter version. If
- >you do, I'd be interested in your solution.
-
- Here's a slightly shorter solution (using the same basic idea as yours):
-
- ea(( x enifed#
- )x(ae enifed#
- };0 nruter;)"dlrow olleh"(stup{
- )diov(niam tni
- }{ int enifed#
- ) main enifed#
- >h.oidts< edulcni#
- ;)diov(niam tni
-
- Again, this is only the second half of the program. BTW, I'd suggest that
- anyone who tries their hand at this mechanically verify the solution is
- a palendrome. It's easy to screw up.
-
- --
- Caught an internal error--.brainrc restored
-