home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / c / 19333 < prev    next >
Encoding:
Internet Message Format  |  1993-01-06  |  1.6 KB

  1. Path: sparky!uunet!cs.utexas.edu!asuvax!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
  2. From: dave@cs.arizona.edu (Dave Schaumann)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: C palindrome puzzle: a solution
  5. Message-ID: <1993Jan6.214531.3364@organpipe.uug.arizona.edu>
  6. Date: 6 Jan 93 21:45:31 GMT
  7. References: <C0DuoE.7M8@sci.kun.nl>
  8. Sender: news@organpipe.uug.arizona.edu
  9. Reply-To: dave@cs.arizona.edu (Dave Schaumann)
  10. Organization: University of Arizona
  11. Lines: 40
  12. In-Reply-To: ronny@cs.kun.nl (Ron Wichers Schreur)
  13.  
  14. [the rules: write a C program that's a palendrome and prints out "hello, world"
  15.  
  16. In article <C0DuoE.7M8@sci.kun.nl>, ronny@cs (Ron Wichers Schreur) writes:
  17. >I'll only post the second half of my program:
  18. >
  19. >    ab(( b enifed#
  20. >    cd enifed#
  21. >    cb bc enifed#
  22. >    ;dc int enifed#
  23. >    diov main enifed#
  24. >    niam tni void enifed#
  25. >    };0 nruter;dc"dlrow olleh"cb stup{
  26. >    ) dc enifed#
  27. >    )diov cb niam tni
  28. >    ab( cb enifed#
  29. >    >h.oidts<edulcni#
  30. >    ab enifed#
  31. >    )ab(ba enifed#
  32. >    ;)diov(niam tni
  33. >
  34. >It must be possible to find a shorter version. If
  35. >you do, I'd be interested in your solution.
  36.  
  37. Here's a slightly shorter solution (using the same basic idea as yours):
  38.  
  39.     ea(( x enifed#
  40.     )x(ae enifed#
  41.     };0 nruter;)"dlrow olleh"(stup{
  42.     )diov(niam tni
  43.     }{ int enifed#
  44.     ) main enifed#
  45.     >h.oidts< edulcni#
  46.     ;)diov(niam tni
  47.  
  48. Again, this is only the second half of the program.  BTW, I'd suggest that
  49. anyone who tries their hand at this mechanically verify the solution is
  50. a palendrome.  It's easy to screw up.
  51.  
  52. -- 
  53. Caught an internal error--.brainrc restored
  54.