eolymp
bolt
Try our new interface for solving problems

Line

Given a string consisting only of digits. In one move you can delete from this any sequence of consecutive identical digits. What is the minimum number of moves in which you can delete the entire row?

Input

One string of digits. The string length does not exceed 300 characters.

Output

Print the minimum number of moves in which you can delete the entire line.

Time limit 1 second
Memory limit 122.17 MiB
Input example #1
1343223
Output example #1
4
Source Crimea-2010