Given a string s, partition s such that every substring of the partition is a palindrome. Find the minimum cuts needed for palindromic partition of s.
s: “aabc”
Min cuts: 2
Palindromic partition: [“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 one line containing an integer denoting the minimum number of cuts.
4
aabc
aca
hot
coffee
2
0
2
3
1 <= T <= 10
1 <= length of s <= 200
Each character of s is a lowercase english alphabet.