PythiloMedium · 25 min · Task 72 of 100 · progress kept in this browser

Partition into palindromes

Return every partition of text into palindromic substrings, in lexicographic list order. Empty text has one partition: [].

text = 'aab'
for end in range(1, len(text)+1):
    piece = text[:end]
    print(piece, piece == piece[::-1])
Your task

Return every partition of text into palindromic substrings, in lexicographic list order. Empty text has one partition: [].