Output only the palindromic words

Hello everyone! The Brain Teaser series continues.

First, we would like to announce the winner of the previous brain teaser. We got a number of very interesting and creative solutions. The shortest answer — [Net.DNS]::GetHostAddresses(“”), with 31 characters — was given by sahal. So, he is the winner!

Congratulations sahal, you get an eBook version of Microsoft Windows PowerShell 3.0 First Look written by Adam Driscoll and published by Packt.

We would like to thank Joel ‘Jaykul’ Bennett for the new brain teaser.

You have an array of words: ‘Hannah’,’Jeffrey’,’12321′,’Madam’,’Abracadabra’. Your new task is to output only palindromic words.

The input is: ‘Hannah’,’Jeffrey’,’12321′,’Madam’,’Abracadabra’

The output is:

Hannah

12321

Madam

Once again, the shortest answer wins! Be aware, a space is a character too.

Please use the comment box at the bottom of this page to submit your solutions by Friday. The winner will be announced on the next Monday.

Don’t have a solution of your own or has it already been posted by others? You can still participate and add your voice by voting on the existing comment by using the up/down voting arrows.

This time, the prize is again the eBook version of Microsoft Windows PowerShell 3.0 First Look written by Adam Driscoll. We would like to thank our sponsor Packt, one of the most prolific and fast-growing tech book publishers in the world, for providing such a cool prize.

Good luck!

Share on: