Re: OT: regular expression question
>>>>> "Eric" == Eric G Miller <egm2@jps.net> writes:
Eric> On Thu, Dec 07, 2000 at 05:29:29PM -0700, Hubert Chan wrote:
>> >>>>> "Frodo" == Frodo Baggins <thehobbit@altern.org> writes:
>>
Frodo> Take the palindrome w=aaa...abb...b where there are n 'a' and n
>> That's not a palindrome. A palindrome is a word in which the first
>> "half" is the reverse of the second "half" (half is in quotes because
>> the word may have an odd number of letters). For example abccba is a
>> palindrome. Or abcba.
>>
>> AFAICT the pumping lemma still works. I'm just too lazy/tired to apply
>> it.
Eric> Palindromes aren't restricted to words, and can ignore punctuation
Eric> and space.
Eric> A Man, a Plan, a Canal, Panama
Eric> or
Eric> Able was I ere I saw Elba
It all depends on what you mean when you say "word". I used it in the abstract
sense, which is just a string of characters. So abcba is a word, even though
it is not an English word.
Strictly, "A Man, a Plan, a Canal, Panama" is not a palindrome if you're
talking about abstract words, because of commas and spaces, but
"amanaplanacanalpanama" is. (And "amanaplanacanalpanama" is also a word in the
abstract sense.) But if you want to treat spaces, punctuation, and
capitalization as irrelevant decorations, then you could say that "A Man, a
Plan, a Canal, Panama" is the same as "amanaplanacanalpanama" and is a
palindrome.
Hubert
--
____ | -----------------------------------------------------------
| / --+--
| / ___|___ Hubert Chan <hackerhue@crosswinds.net>
| \ | _|_ |
|__| |__|__| GCS/M d- s:- a-- C++ UL+(++++) P++ L++ E++ W++ N++ o?
| | K? w--- O++ M- V- PS-- PE+++ Y+ PGP+ t+ 5 X R- tv+ b+
| / | \ DI++++ D G e++ h! !r !y
| / | \
| | <><------------------ http://www.crosswinds.net/~hackerhue/
PGP/GnuPG fingerprint: 6CC5 822D 2E55 494C 81DD 6F2C 6518 54DF 71FD A37F
Key can be found at http://www.crosswinds.net/~hackerhue/hackerhue.asc
Reply to: