Palindrome Partitioning#11245

Palindrome Partitioning

2 segundos
128 megabytes
Media (≈1350)

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:

Entrada

One string of length no more than .

Salida

Print the minimum number of cuts needed for the palindromic partitioning of the string .

Ejemplos

Ejemplo 1

Loading
Loading

Ejemplo 2

Loading
Loading

Ejemplo 3

Loading
Loading