Sometimes a string has buried palindromes in it:
hallolilah
contains lol
.
And if we took out lol
, we'd be left with halilah
...which is another palindrome.
Write a program/function that returns the minimum letters left over after repeatedly removing palindromes of at least 3 letters.
Possibly the order in which palindromes are removed affects the number of letters remaining, hence "minimum".
Input
A string of lowercase letters.
Output
A string of leftover lowercase letters.
Scoring
Code golf
Sample data
bazookabambino
=> bazookmbino
bamalamacocob
=> `` (empty string)
boofrooracecarnaanoorfood
=> bd
gogogogogogogogogonow
=> w
nopalindromesinthisone
=> nopalindromesinthisone
canacandothecancan
=> cadothecancan
or andothecancan
acaaaab
=> b
canacandothecancan
=>andothecancan
\$\endgroup\$