LearnPy Hub
← Arena
AdvancedRating 1700

Fewest Palindrome Cuts

Cut the string into pieces so that every piece is a palindrome. Print the fewest cuts needed.

Input

One string (length ≤ 1500).

Output

One integer.

Sample 1

Input
aab
Output
1

Sample 2

Input
a
Output
0
solution.py
Output appears here
Fewest Palindrome Cuts · Python Arena problem · LearnPy Hub