Palindrome Partitioning II: revise code