#ABC120C. [ABC120C] Unification

[ABC120C] Unification

提示:该题测试数据补录中,暂不支持评测提交。

No testdata at current.

No submission language available for this problem.

Score : 300300 points

Problem Statement

There are NN cubes stacked vertically on a desk.

You are given a string SS of length NN. The color of the ii-th cube from the bottom is red if the ii-th character in SS 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.

At most how many cubes can be removed?

Constraints

  • 1≤N≤1051 \leq N \leq 10^5
  • ∣S∣=N|S| = N
  • Each character in SS is 0 or 1.

Input

Input is given from Standard Input in the following format:

SS

Output

Print the maximum number of cubes that can be removed.

0011
4

All four cubes can be removed, by performing the operation as follows:

  • Remove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.
  • Remove the first and second cubes from the bottom.
11011010001011
12
0
0