Backtrack all cut positions, only cutting at palindromic substrings.
Precompute isPal[l][r] via DP.
Then DFS from index i, try every j >= i where s[i..j] is palindrome, append it, and recurse at j+1.
Every valid partition is a sequence of palindromic segments; DP allows O(1) palindrome checks during backtracking.
Backtrack all cut positions, only cutting at palindromic substrings.
Precompute isPal[l][r] via DP.
Then DFS from index i, try every j >= i where s[i..j] is palindrome, append it, and recurse at j+1.
Every valid partition is a sequence of palindromic segments; DP allows O(1) palindrome checks during backtracking.