Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Do you know where your variables are?
 
PerlMonks  

Re: Finding longest palindrome from a string

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

Replies are listed 'Best First'.
Re^2: Finding longest palindrome from a string
by tune (Curate) on Aug 13, 2004 at 04: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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://382573]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.