J - Joining cubes

Languages: C, C++, Java, Python, Kotlin, C#
Time & Memory limits: (details)

There are N cubes stacked vertically on a desk. You are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.

You can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.

What is the maximum number of cubes that can be removed?

Input

The input contains one line with the string S and with |S|=N and  1N105. Each character in S is 0 or 1.

Output

Print the maximum number of cubes that can be removed.

Sample test(s)

Input
0011
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
4
--- Showing first 30 lines (click "Copy" to get full content) ---
Input
11011010001011
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
12
--- Showing first 30 lines (click "Copy" to get full content) ---
Input
0
--- Showing first 30 lines (click "Copy" to get full content) ---
Output
0
--- Showing first 30 lines (click "Copy" to get full content) ---