Palindrome Partitioning
Execution time limit is 2 seconds
Runtime memory usage limit is 128 megabytes
A string partition is called a palindromic partition if every substring in this partition is a palindrome. For example, the string "ababbbabbababa" can be partitioned as "aba|b|bbabb|a|b|aba" — this is an example of a palindromic partition.
Determine the minimum number of cuts required for the palindromic partitioning of a given string. For example:
for the string "" a minimum of cuts are needed to create the partition "";
if the string is already a palindrome, cuts are needed;
if all the characters of a string of length are different, the minimum number of cuts required is .
Input
One string of length no more than .
Output
Print the minimum number of cuts needed for the palindromic partitioning of the string .
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Submissions 58
Acceptance rate 59%