Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Finding longest palindrome from a string

by tune (Curate)
on Aug 13, 2004 at 08:43 UTC ( #382573=note: print w/ replies, xml ) Need Help??


in reply to Finding longest palindrome from a string

A very humble attempt:
sub tune { my $l = ""; map {$l=$_ if ($_ eq reverse $_)&&(length $l<length $_)} split /\s ++/, $_[0]; return $l; }

--
tune


Comment on Re: Finding longest palindrome from a string
Download Code
Replies are listed 'Best First'.
Re^2: Finding longest palindrome from a string
by tune (Curate) on Aug 13, 2004 at 08:49 UTC
    Oops, mine won't work with in-string palindromes. Disqualify me. =:(

    --
    tune

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://382573]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2015-07-30 00:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls