word. Cut it into contiguous pieces so that every piece is a palindrome, meaning it reads the same forwards and backwards. A single letter counts as a palindrome.
Return every possible way to cut it. Each way is a list of pieces in the order they appear in the word. The ways themselves may be listed in any order.word="noon" → [['n', 'o', 'o', 'n'], ['n', 'oo', 'n'], ['noon']]
You can cut it into single letters, keep the middle "oo" together, or leave the word whole, since it is a palindrome itself.
word="xyx" → [['x', 'y', 'x'], ['xyx']]
"xy" and "yx" are not palindromes, so there are only two ways.
word="q" → [['q']]
word consists of lowercase English lettersword="noon"
[['n', 'o', 'o', 'n'], ['n', 'oo', 'n'], ['noon']]
Run checks the first 3 tests in your browser. Submit checks all 112 tests on the server, hidden ones included.