Skip to main content
added 109 characters in body
Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 999

Wolfram Language (Mathematica), 5353 51 bytes

Byte count assumes CP-1252 encoding.

#/.±{a___,Shortest@b___,c___}/;PalindromeQ[a<>c]:>={b}& 

Try it online!Try it online!

Defines a unary operator ± (or a function PlusMinus). Input and output are lists of characters. The test suite does the conversion from and to actual strings for convenience.

Wolfram Language (Mathematica), 53 bytes

#/.{a___,Shortest@b___,c___}/;PalindromeQ[a<>c]:>{b}& 

Try it online!

Input and output are lists of characters. The test suite does the conversion from and to actual strings for convenience.

Wolfram Language (Mathematica), 53 51 bytes

Byte count assumes CP-1252 encoding.

±{a___,Shortest@b___,c___}/;PalindromeQ[a<>c]:={b} 

Try it online!

Defines a unary operator ± (or a function PlusMinus). Input and output are lists of characters. The test suite does the conversion from and to actual strings for convenience.

Source Link
Martin Ender
  • 198.2k
  • 67
  • 455
  • 999

Wolfram Language (Mathematica), 53 bytes

#/.{a___,Shortest@b___,c___}/;PalindromeQ[a<>c]:>{b}& 

Try it online!

Input and output are lists of characters. The test suite does the conversion from and to actual strings for convenience.