String reduction

Time Limit: 1000ms
Memory Limit: 65536KB
This problem will be judged on PKU. Original ID: 3401
64-bit integer IO format: %lld      Java class name: Main

Description

There is a string of characters 'a' and 'b' with the length of no more than 255 characters. You can perform the substring reduction on the initial string in the following way: a substring "a*a" or "b*b" (where * (asterisk) denotes any character) can be reduces to a substring "*".

The task is to achieve a string of minimal possible length after several substring reductions.

Input

The input contains the initial string.

Output

The output contains a single line with the minimal possible length.

Sample Input

aab

Sample Output

3

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .