Given a string s, partition s such that every substring of the partition is a palindrome. Find all possible ways of palindromic partitioning.
s: “aabc”
Partitions: [
[“a”, “a”, “b”, “c”],
[“aa”, “b”, “c”]
]
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input has one line with the string ‘s’.
For each test case, the output has following lines:
3
abbc
a
cdc
2
a b b c
a bb c
1
a
2
c d c
cdc
1 <= T <= 100
1 <= length of s <= 16
Each character of s is a lowercase english alphabet.