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.
At most how many cubes can be removed?

-----Constraints-----
 - 1 \leq N \leq 10^5
 - |S| = N
 - Each character in S is 0 or 1.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
Print the maximum number of cubes that can be removed.

-----Sample Input-----
0011

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

Solutions:
s =input()

from collections import Counter
count = Counter(s)
c0 = count["0"]
c1 = count["1"]

print(min(c0,c1)*2)

s = input()
z = s.count('0')
print(2*min(z, len(s)-z))

S = input()

num_0 = S.count('0')
num_1 = S.count('1')

print(min(num_0, num_1)*2)

S = list(input())

print(2*min(S.count("1"),S.count("0")))

S = input()
stack = []
count = 0
for s in S:
  if not stack:
    stack.append(s)
  elif stack[-1]!=s:
    stack.pop()
    count+=2
  else:
    stack.append(s)
print(count)

def main2():
    s = input()
    one = s.count('0')
    zero = s.count('1')
    print(min(one, zero)*2)


def __starting_point():
    main2()
__starting_point()

s = input()
print(min(s.count('0'), s.count('1'))*2)

import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans)

def __starting_point():
    resolve()

__starting_point()

s = input()
n = len(s)
a = s.count('1')
b = s.count('0')
if a>=b:
  print(b*2)
else:
  print(a*2)

S = input()
z = S.count("0")
o = S.count("1")

print(len(S)-abs(z-o))

s = input()

zero = s.count('0')
one = s.count('1')

print(min(zero,one)*2)

S = input()

print(min(S.count("1"), S.count("0")) * 2)

s = input()
red = s.count("0")
blue = s.count("1")

print(min(red,blue)*2)

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = ns()
n = len(s)
b = s.count('0')
r = n - b
print(2 * min(b, r))

s = input()

red = 0
blue = 0
for i in s:
  if i == "0":
    red += 1
  else :
    blue += 1
    
print((red+blue-abs(red-blue)))


import sys

cubes = list(input()) # 入力受付
stack = []
count = 0

for cube in cubes:
    if not stack:
        stack.append(cube)
    elif stack[-1] != cube:
        count += 2
        stack.pop()
    else:
        stack.append(cube)
print(count)


s=input()
a=s.count('0')
b=s.count('1')
c=min(a,b)
print(2*c)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-09-11 14:10:37 +0900
# LastModified: 2020-09-11 14:16:43 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    S = input()
    if S.count('0') < S.count('1'):
        print((S.count('0')*2))
    else:
        print((S.count('1')*2))


def __starting_point():
    main()

__starting_point()

S = list(input())
print((2*(min(S.count("0"),S.count("1")))))


S = input()

print(min(S.count("0"), S.count("1"))*2)

def main():
    s = input()
    zero = s.count("0")
    one = s.count("1")
    print(min(zero, one) * 2)

main()

s=list(str(input()))
a=s.count('0')
b=s.count('1')

print(min(a,b)*2)

S=input()
d=[0,0]
for i in S:
  d[int(i)]+=1
print((min(d)*2))


S = str(input())

zero = S.count('0')
one = S.count('1')

ans = min(zero,one)
print(ans*2)

s = list(input())
print((min(s.count("0"), s.count("1")) * 2))


S=list(input())

a=S.count('0')
b=S.count('1')
print(min(a,b)*2)

s = input()
zero = 0
one = 0
for i in s:
  if i == '0':
    zero += 1
  else:
    one += 1
ans = min(one, zero)
print(((ans) << 1))


s=input()

num_0 = 0
num_1 = 0
for i in range(len(s)):
  if s[i] == '0':
    num_0 += 1
  else:
    num_1 += 1
    
print(min(num_0,num_1)*2)

S = input()
z = 0
o = 0
for c in S:
    if c == '0':
        z += 1
    else:
        o += 1
print(min([z,o])*2)

print(2*min(list(map(input().count,("10")))))

S = input()
N = len(S)

cnt = 0

for s in S:
    if s == '0':
        cnt += 1

print(2 * min(cnt, N - cnt))

S = list(input())

print(min(S.count("0"), S.count("1")) * 2)

# author:  Taichicchi
# created: 12.09.2020 12:29:36

from collections import Counter
import sys

S = input()

c = Counter(S)

print((len(S) - abs(c["0"] - c["1"])))


S = str(input())
x = S.count("0")
y = S.count("1")
print((2*min(x, y)))


S=input()
o=0
i=0
for j in S:
    if j=="0":
        o+=1
    else:
        i+=1
print(min(o,i)*2)

S = input()
print(2*min(S.count("0"),S.count("1")))

s = input()

z = 0
o = 0
for c in s:
    if c == '1':
        o += 1
    else:
        z += 1

print((min(o, z) * 2))


s=list(input())
a=s.count('0')
b=s.count('1')
print(min(b,a)*2)

s = input()
n = min(s.count("0"),s.count("1"))
print(n*2)

S = list(map(int, list(input())))
N = len(S)
cnt = [0,0]
for i in S:
  cnt[i] += 1
print(2 * min(cnt))

s = list(input())

length = len(s)

r = s.count('0')
b = s.count('1')

print(length - abs(r-b))

S = input()

red = 0
blue = 0
for s in S:
    if s == '0':
        red += 1
    elif s == '1':
        blue += 1
print((min(red, blue)*2))
        


S = input()
c0 = S.count('0')
c1 = S.count('1')
print(min(c0,c1)*2)

S=input()
stack=[]
count=0
for s in S:
    if not stack:
        stack.append(s)
    elif stack[-1]!=s:
        stack.pop()
        count+=2
    else:
        stack.append(s)
print(count)

# coding:utf-8
s = input()
a = s.count('0')
b = s.count('1')

print((2 * min(a, b)))


S = input()

zero_count=S.count("0")
one_count=S.count("1")

ans=2*min(int(zero_count),int(one_count))
print(ans)

s = str(input())
x = s.count('0')
y = s.count('1')
print(min(x,y)*2)

s = input()
l = list(s)

a = l.count('0')
b = l.count('1')

ans = 2 * min(a, b)
print(ans)

S = input()
 
# 0と1は可能な限り打ち消し合う
c0 = S.count('0')
c1 = S.count('1')

print(2*min(c0, c1))

S = input()

cnt_0 = S.count("0")
min_cnt_01 = min(cnt_0,len(S) - cnt_0)
print(min_cnt_01 * 2)

S = input()

# 0と1が可能な限り打ち消しあう様を想像せよ
c0 = S.count('0')
c1 = S.count('1')
print(2*min(c0, c1))

s = input()
print(2*min(s.count("0"),s.count("1")))

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    red = S.count('0')
    blue = len(S) - red

    print((min(red, blue) * 2))

    return


def __starting_point():
    main()

__starting_point()

s = input()
r = s.count("0")
b = s.count("1")
print(r + b - abs(r - b))

S = input()
cnt0 = 0
cnt1 = 0
for i in S:
    if i == '0':
        cnt0 += 1
    else:
        cnt1 += 1
print(min(cnt0, cnt1) * 2)

s=input()
cnt0 = 0
cnt1 = 0
for i in s:
    if i == '0':
        cnt0 +=1
    else:
        cnt1 +=1

print(2*min(cnt0,cnt1))

s = input()
b = 0
w = 0
for i in range(len(s)):
    if(s[i] == '0'):
        b = b+1
    if(s[i] == '1'):
        w = w+1

print((2*min(b,w)))



s = input()

a = 0
b = 0

for i in range(len(s)):
  if s[i] == "0":
    a += 1
  else:
    b += 1

print(min(a,b)*2)


s = input()
print(2 * min(s.count('0'),s.count('1')))

import collections
S=list(str(input()))
cc=collections.Counter(S)
ans=min(cc['0'],cc['1'])
print(ans*2)

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    S = input().rstrip()
    stack=[]
    count=0

    if S=="0":
        print("0")
        return

    for s in S:
        if len(stack)==0:
            stack.append(str(s))
        else:
            if s != stack[-1]:
                count+=1
                stack.pop()
            else:
                stack.append(str(s))
    print(2*count)

def __starting_point():
    main()
__starting_point()

S = list(input())

print(2 * min(S.count('0'), S.count('1')))

from collections import deque

S = input()

d = deque()
cnt = 0
for s in S:
    if d:
        if d[-1] != s:
            d.pop()
            cnt += 2
        else:
            d.append(s)
    else:
        d.append(s)

print(cnt)


S = list(input())

c0 = S.count("0")
c1 = S.count("1")

print(2 * min(c0,c1))

a = list(input())
count = 0
num = 0
while(a != []):
  if num == -1:
    num += 1
    continue
  if num == len(a) or len(a) == 1 or (num == len(a)-1 and a[-1] == a[-2]):
    break
  if (a[num] == '0' and a[num + 1] == '1') or (a[num] == '1' and a[num + 1] == '0') :
    #print("OK", num)
    a.pop(num)
    a.pop(num)
    #print(a)
    count += 2
    num -= 1
  else:
    num += 1
print(count)

s = input()
print(len(s)-abs(s.count('1')-s.count('0')))

S=list(input())[::-1]
que=[]
N=len(S)
ans=0

while len(S)>0:
	que.append(S.pop(-1))
	if len(que)>1:
		if (que[-1]=="1" and que[-2]=="0") or (que[-1]=="0" and que[-2]=="1"):
			que.pop(-1)
			que.pop(-1)
			ans+=2

print(ans)

S=input()
List = list(S)
zeroNum = List.count("0")
oneNum = List.count("1")
res = min(zeroNum,oneNum)
print(res*2)

s = input()
# 0: red
# 1: blue
n = len(s)

cnt_r = 0
cnt_b = 0
for c in s:
    if c=="0":
        cnt_r+=1
cnt_b = n-cnt_r
print(2*min(cnt_r, cnt_b))

S = input()

zero = S.count("0")
one = S.count("1")

if zero != 0 and one != 0:
  print(min(zero,one)*2)
else:
  print(0)

from collections import Counter
S = str(input())
c = Counter(S)
d = c.most_common()
if len(d) == 2:
  ans = d[1][1] * 2
  print(ans)
else:
  print(0)

S = input()
A = S.count("0")
B = S.count("1")
print(2*min(A, B))

import collections
s = list(map(str,input()))
ans =0
a=collections.Counter(s)
if len(a)==1:
  print((0))
else:
  print((min(a.values())*2))



from collections import Counter

num_dict = Counter(input())

if num_dict.get("0") is not None and num_dict.get("1") is not None:
    if num_dict.get("0") > num_dict.get("1"):
        print(num_dict.get("1") * 2)
    else:
        print(num_dict.get("0") * 2)
else:
    print(0)

s=input()
s=list(s)

a=s.count('0')
b=s.count('1')

print((min(a,b)*2))


S=input()
print((min(S.count('0'),S.count('1'))*2))


S = input()
zero = S.count("0")
one = S.count("1")
print(min(zero, one) * 2)

S = input()
s_lis= list(S)
r_cout=s_lis.count('1')
w_cout=s_lis.count('0')
print(2*(min(r_cout,w_cout)))

s = list(input())
n = len(s)
t = []
while s:
  c = s.pop()
  if t and t[-1] != c:
    t.pop()
  else:
    t.append(c)
print(n - len(t))

s=input()
num_0=0
num_1=0
for i in range(len(s)):
  if s[i]=="0":
    num_0+=1
  else:
    num_1+=1

print(min(num_0,num_1)*2)

# -*- coding: utf-8 -*-
"""
Created on Mon Sep 14 01:36:50 2020

@author: liang
"""

S = input()
c0 = 0
c1 = 0
for i in range(len(S)):
    if S[i] == "0":
        c0 += 1
    else:
        c1 += 1
ans = len(S) - abs(c0-c1)
print(ans)

import math
from collections import Counter
s = list(input())
s = list(map(int, s))
dict_s = Counter(s)
#print(dict_s)
print((min(dict_s[0], dict_s[1]))*2)

S=input()
zero=0
one=0
for i in range(len(S)):
    if S[i]=='1':
        one+=1
    else:
        zero+=1
print((min(zero,one)*2))


S = input().rstrip()
print(min(S.count("0"),S.count("1"))*2)

a=list(input())
temp1=0
temp0=0

for i in range(len(a)):
    if a[i]=="0":
        temp0+=1
    else:
        temp1+=1
print((min(temp0,temp1)*2))


S = input()
stack = []
cnt = 0
for s in S:
    if not stack:
        stack.append(s)
    elif stack[-1] != s:
        stack.pop()
        cnt += 2
    else:
        stack.append(s)
print(cnt)

s = input()
st = []
ans = 0
for e in s:
  if len(st) == 0:
    st.append(e)
  else:
    if st[-1] != e:
      st.pop()
      ans += 2
    else:
      st.append(e)
print(ans)

S = list(input())
one = S.count('1')
zero = S.count('0')

print(2*min(one,zero))

S = str(input())
x = len(S)
if '0' in S:
  y0 = S.count('0')
else:
  y0 = 0
if '1' in S:
  y1 = S.count('1')
else:
  y1 = 0
  
d = abs(y0 - y1)
print((x - d))


s = input()
s0 = s.count('0')
s1= s.count('1')
print(2*min(s0,s1))

S=list(input())
A=S.count('1')
B=S.count('0')
print(min(2*A,2*B))

S = input()
 
a = S.count('0')
b = S.count('1')
print(2*min(a,b))

S = input()
x = S.count('0')
y = S.count('1')

ans = 2 * (min(x, y))
print(ans)

s = input()
r = 0
b = 0

for i in range(len(s)):
  if s[i] == "0":
    r += 1
  if s[i] == "1":
    b += 1

print(2 * min(r, b))

N = str(input())
one = N.count('1')
zero = N.count('0')

print(min(one,zero)*2)

from collections import Counter

def main():
    S = input()
    cs = Counter(S)
    ans = min(cs['0'], cs['1'])*2
    print(ans)

def __starting_point():
    main()

__starting_point()

S = list(input())
N = len(S)
len0 = S.count('0')
len1 = S.count('1')
rm = min(len0,len1)
print(2*rm)

b=input()
A=b.count("1")
B=b.count("0")
print(min(2*A,2*B))

S = input()
cnt_0 = S.count('0')
cnt_1 = S.count('1')

print((min(cnt_0, cnt_1)*2))


s = list(input())
c0 = s.count('0')
c1 = s.count('1')

mi = min(c0,c1)
print(mi*2)