*   *   *   *
  LOGOLOG
a weblog of wordplay by Eric Harshbarger

Palindromic Substrings

I recently wrote a script to scan texts and extract the longest palindromic substring therein (all non-letter characters, like spaces, punctuation, and numerals, are ignored). It works quite efficiently, and I was able to quickly search through literary texts as long at Melville's Moby Dick, and Tolstoy's War and Peace in a matter of seconds. Here are some interesting results after scanning through 100 of the most popular public domain texts downloaded from Project Gutenberg on 5 December 2021:

Mary Shelley's Frankenstein contains a few 9-letter substrings:
NEVEREVEN, '... never even ...'
ELIEVEILE, '... I believe I left him ...'
EREWEWERE, '... where we were seated ...'
TRONGNORT, '... a strong northerly blast ...'

Nine letter examples are fairly common; many literary works of any length contain at least one such example. Jane Austen's Pride and Prejudice contains quite a few:
NERALAREN, '... ladies in general are not ...'
HEREWEREH, '... there were half-hours of pleasant conversation ...'
NEVEREVEN
ENDEREDNE, '... was rendered necessary ...'
EREWEWERE, '... if it were. We were always good friends ...'
MERECEREM, '... the mere ceremonious salutation ...'
ERWASAWRE, '... disposing of her-was a wretched reflection ...'

Nathaniel Hawthorne's, The Scarlet Letter, contains this 10-letter substring:
NISOPPOSIN, '... wronged old man is opposing it ...'

Kate Chopin's The Awakening has an 11-letter substring that originates from a single word:
SENSUOUSNES, '... all her awakening sensuousness. He saw ...'
(Friedrich Wilhelm Nietzsche's Beyond Good and Evil also contains this example.)

Herman Melville's Moby Dick has a 12-letter:
PULLUPPULLUP, '... "Pull up-pull up!" ...'
(Jane Austen's Emma includes the 14-letter variation: '... Put it up, put it up ...')

Charles Dicken's A Christmas Carol has a longer one at 13 in length, but it is the not-very-interesting:
HAHAHAHAHAHAH, '... "Ha, ha! Ha, ha, ha, ha!" He said ...'
(Edgar Allan Poe has the same substring appear in The Purloined Letter.)

Niccolo Machiavelli's The Prince has a much more interesting 13-letter one:
UTSIDEBEDISTU, '... and even should affairs outside be disturbed ...'

The King James Version of the Bible clocks in with its longest substring at 13-letter:
NOMANEVENAMON, '... there was no man; even among them ...'

Mark Twain's Advetures of Huckleberry Finn has a 14-letter:
OOGOOGOOGOOGOO, '... and said "Goo-goo--goo-goo-goo" all the time ...'

And The Brothers Karamazov by Fyodor Dostoyevsky has the 14-letter:
OOROOROOROOROO, '... Troo-roo-roo-roo-roo, she'll say! ...'

W. E. B. Du Bois's The Souls of Black Folk extends a common "...ERE..." construction across two sentences for the 15-letter:
EWEREHEREHEREWE, '... the Pilgrims landed we were here. Here we have ...'

Dicken's Great Expectations has this 15-letter substring:
TISAWONENOWASIT, '... and that I saw one now. As it stood open ...'

Dickens seems to have a knack for palindromic inclusions as his A Tale Of Two Cities has an even longer one at 17-letters:
OOLOOLOOLOOLOOLOO, '... See here again! Loo, loo, loo; Loo, loo, loo! And off ...'

Henry David Thoreau's Walden... has this 17-letter onomatopoeia:
OOHOOBOOHOOBOOHOO, '... as well as yourself? Boo-hoo, boo-hoo, boo-hoo! It was one ...'

Should we be surprised that James Joyce's Ulysses has the longest that I've yet found? Albeit a rather boring 20 letters:
EEEEEEEEEEEEEEEEEEEE, '... I can see his face cleanshaven Frseeeeeeeeeeeeeeeeeeeefrong that train again ...'

If you are interested in scan other texts, you may use this webpage I have created: Scan Text For Longest Palindromic Substring.

-- Eric

[6 December 2021]
   
LOGOLOG


Archive
 Anti-Palindro...1
 Palindromic S...
 Dos Equis
 Box Office Pa...
 My Initial Su...
 Incomparable1
 Rock & Roll1
 Aye, Qs!
 This & That
 It's All Abou...1
 Non-Crashing ...
 Pseudo-palind...2
 Box Office Cu...
 All In A Row
 Redividers
 Chemical Symb...1
 Over 636 Pali...2
 Omino Font
 Front Hook: S1
 History of Bo...1
 Front Hook: R
 Well, Moviego...6
 Front Hook: Q
 Front Hook: P
 Front Hook: O
 Front Hook: N1
 Front Hook: M
 Front Hook: L
 Front Hook: K
 Front Hook: J1
 Front Hook: I2
 Front Hook: H4
 Front Hook: G3
 Front Hook: F
 Front Hook: E
 Front Hook: D
 Front Hook: C
 Front Hook: B1
 Front Hook: A
 Multiple Solu...1
 And The Nomin...
 I want a cut ...2
 Stew-word-shi...1
 Scrabble Play...
 The answer is...2
 Pangrams and ...
 Pangrams and ...
 Secret Weapon...
 Colorful Citi...2
 Song, Song, S...2
 Near-Pangramm...2
 Favorite Numb...3
 Periodic Tabl...1
 Body Of Music...
 Filmed In Tec...3
 Cryptic Femal...1
 Colorful Film...1
 Elemental Bod...5
 Ambigrams Rev...1
 Calculated Wo...2
 Teacher Torto...2
 True Story
 Polly-Gone
 Sending My Re...
 A-B-C-D-ary1
 Word Dice3
 That Does It!3
 Lexomino Puzz...
 Morse Code Pa...4
 Bringing Ingo...7
 NIN
 Dot, Dot, Das...2
 Repeated lett...3
 Palindromic P...6
 Palindromic P...
 Sick Pun4
 Typesetting 2...2
 Heterogrammic...5
 Plurals1
 Phoneys1
 What is a "wo...
 Hollywood Nam...
 Front Hooks
 Half Price
 Through The 7...
 W4...1
 ;
 Bourne To Run4
 DVDs2
 V for Very Di...
 Scrabble: Ash...
 Scrabble, red...1
 A=1, B=2, C=32
 4 Sides To Ev...4
 Periodic Tabl...2
 BIVOUAC4
 String of Mov...3
 Where's Winsl...4
 para-palindro...4
 pun
 Standardized ...2
 Unintended Am...1
 Web Too Dah T...1
 Backronym2
 Fishy
 Too clever by...4
 Another wordy...
 Commercialize...1
 Beyond BOOKKE...5
 Not Positive ...11
 Scrabble Tabl...2
 Puzzle1
 Negativity
 Lightning1
 Another Pan-v...1
 Not So Frugal
 Not So Funny ...1
 Memory of GAM...5
 Musical Wordp...
 830
 Funny1
 Chemical Abbr...1
 Movie Rebuses7
 Television Sh...1
 Even More Het...
 More Heterogr...3
 Oooooo...2
 Those crazy H...2
 NFL4
 Wordmonger2
 Alli says, "A...
 A Puzzling St...3
 THE MAD ANAGR...4
 Synonymous Co...1
 CARNELIOUS3
 -und2
 Batteries2
 Names13
 Rubik Font3
 Under A Spell
 State The Rea...2
 7x7 Scrabble ...
 7x7 Scrabble ...
 Scrabble Squa...4
 Tube Maps2
 GAMES Magazin...
 Superbowl: ST...
 Letter Shifti...1
 Projects of L...
 Slices of PI,...
 Slices of PI,...
 Heterogrammic...
 QWERTY vs. Dv...2
 Word Chemistr...
 Heterogrammic...1
 Pangrammic Cr...1
 Comments for ...
 Ambigrams
 Alphabet Soup4
 Logo
 Alpha-Pangram...
 Book List
 Scrabble Tile...
 D'oh!
 Letter Shifti...
 Palindromes
 Pangrammic Cr...
 Phobias1
 Pentominoes
 Word Searchin...1
 Welcome1

 
*   *
*   *
 
Leave a comment on LOGOLOG about the article: Palindromic Substrings
Your Name:  

Your comment (HTML tags will be removed):


Day of week today is:   


 
*   *
*   *
 
Copyright © 2005 - 2021, Eric C. Harshbarger
 
*   * *   *