Problem:
 Score : 300 points    Problem Statement 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 1 0011      Sample Output 1 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.        Sample Input 2 11011010001011      Sample Output 2 12       Sample Input 3 0      Sample Output 3 0

Solution (Python):

def calc_data(data):
    count = 0
    c_0, c_1 = 0, 0
    for i in range(len(data)):
        if data[i] == '0':
            if c_1 > 0:
                count += 2
                c_1 -= 1
            else:
                c_0 += 1
        if data[i] == '1':
            if c_0 > 0:
                count += 2
                c_0 -= 1
            else:
                c_1 += 1
    print(count)

def main():
    data = input()
    calc_data(data)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
n = len(s)
x = []

for i in s:
    x.append(i)

cnt_0 = x.count("0")
cnt_1 = x.count("1")

if cnt_0 == cnt_1:
    print(n)
else:
    print((2*min(cnt_0, cnt_1)))

Solution (Python):
s = input()
N = len(s)
s = list(map(int, sorted(s, reverse=True)))

bl = [True for _ in range(N)]

ans = 0
left_edge = 0
a, b = 0, 1
while 0 <= a and b < N:
    if (s[a] == 0 and s[b] == 1) or (s[a] == 1 and s[b] == 0):
        ans += 2
        bl[a] = False
        bl[b] = False
        if a == left_edge:
            while a < N and not bl[a]:
                a += 1
            b = a + 1
            while b < N and not bl[b]:
                b += 1
            left_edge = a
        else:
            while 0 <= a and not bl[a]:
                a -= 1
            if a == -1: break
            while b < N and not bl[b]:
                b += 1
    else:
        a += 1
        while a < N and not bl[a]:
            a += 1
        b = a + 1
        while b < N and not bl[b]:
            b += 1
print(ans)

Solution (Python):
S=raw_input()
A=[]
Ans=0
for i in range(len(S)):
    if len(A)>0:
        if A[-1]!=S[i]:
            A.pop()
            Ans+=2
        else:
            A.append(S[i])
    else:
        A.append(S[i])

print Ans

Solution (Python):
def solve(S):
    return min(S.count("1"), S.count("0")) * 2

if __name__ == "__main__":
    S = input()
    print(solve(S))

Solution (Python):
import sys
from collections import Counter
S = input()
ct = Counter(list(S))
if len(ct.keys()) == 1:
    print(0)
else:
    print(min(ct.values()) * 2)

Solution (Python):
s=input()
print(len(s)-abs(s.count("1")-s.count("0")))

Solution (Python):
a = list(map(int,list(input())))
c = 1
co = 0
p = a[0]
pp = []
for i in range(len(a)-1):
	if a[(i+1)] == p:
		c += 1
	else:
		pp.append(c)
		c = 1
		p = a[i+1]
pp.append(c)
if len(pp) != 1:
	ppp = pp[0]
	for i in range(len(pp)-1):
		if pp[i] >= 0:
			co += 2*(max(pp[i],pp[i+1]) - abs(pp[i] - pp[i+1]))
			pp[i+1] = pp[i+1] - pp[i]
		else:
			pp[i+1] = pp[i+1] - pp[i]
print(co)

Solution (Python):
s = input()

count_0 = 0
count_1 = 0

for i in s:
    if(i == "0"): count_0 += 1
    else: count_1 += 1

print(min([count_0, count_1])*2)

Solution (Python):
def solve(s):
    one = 0
    zero = 0
    for i in range(len(s)):
        if s[i] == "1":
            one += 1
        elif s[i] == "0":
            zero += 1
    return min(zero, one)


def main():
    S = input()
    

    print(solve(S) * 2)


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
n = len(s)
i = s.count("0")
print(min(i, n-i)*2)

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

Solution (Python):
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())



S = ""


def set_inputs():
    global S
    S = get_str()


def main():
    set_inputs()
    stack = []
    ret = 0
    for c in S:
        if stack and stack[-1] != c:
            ret += 2
            stack.pop(-1)
        else:
            stack.append(c)
    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
all_count = len(S)
zero_count = S.count('0')
one_count = S.count('1')
print(all_count - abs(zero_count - one_count))

Solution (Python):
from sys import stdin
l = stdin.readline().rstrip().split()[0]
print(min(l.count('0'), l.count('1')) * 2)

Solution (Python):







s = input()

st = []


for i in s:
    if len(st) == 0 or st[-1] == i:
        st.append(i)
    else: st.pop()

print(len(s) - len(st))

Solution (Python):
ss = input()

zero = 0
one = 0

for s in ss:
	if s == "0":
		zero+=1
	else:
		one+=1

print(min(zero, one)*2)

Solution (Python):
s = list(input())
n_1 = s.count('1')
n_0 = s.count('0')
print(min(n_0,n_1)*2)

Solution (Python):
S=list(input())
ans=0
j=0
while len(S)-1>j:
    if S[j]!=S[j+1]:
        S.pop(j)
        S.pop(j)
        ans+=2
        if j>0:
            j-=1
        continue
    j+=1
print(ans)

Solution (Python):
S = input()
N = len(S)
i = 0
cnt = 0
while i < N-1:
    if (S[i] == "0" and S[i+1] == "1") or (S[i] == "1" and S[i+1] == "0"):
        S = S[:i] + S[i+2:]
        N -= 2
        cnt += 2
        if i > 0:
            i -= 1
    else:
        i += 1
print(str(cnt))

Solution (Python):
S = [int(_) for _ in list(input())]
print(len(S) - abs(2 * sum(S) - len(S)))

Solution (Python):
s = input()
num_0 = s.count("0")
num_1 = s.count("1")
ans = 2 * min(num_0, num_1)
print(ans)

Solution (Python):
S = input()
tmp = 0
ans = 0
for i in range(len(S)):
    if S[i] == "0":
        if tmp > 0:
            ans += 2
        tmp -= 1
    elif S[i] == "1":
        if tmp < 0:
            ans += 2
        tmp += 1
    
print(ans)

Solution (Python):
s = raw_input()
r = s.count('0')
b = s.count('1')
print(min(r, b) * 2)

Solution (Python):
s = input()

l = len(s)
c = 0

for i in range(l):
    if s[i]=="1":
        c+=1

if (l>=c*2):
    print(c*2)
else:
    print((l-c)*2)

Solution (Python):
string = input()
N = [0, 0]
for c in string:
    N[int(c)] += 1
print(min(N) * 2)

Solution (Python):
S = input()

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

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

Solution (Python):
s=input()
zero=0
one=0
for i in s:
  if i=="0":
    zero+=1
  elif i=="1":
    one+=1
print(min(zero,one)*2)

Solution (Python):
a = input()
a_li = list(map(int, a))


if (a_li.count(0) == 0 or a_li.count(1) == 0):
    print(0)
elif (a_li.count(1) >= a_li.count(0)):
    print(a_li.count(0)*2)
elif (a_li.count(0) >= a_li.count(1)):
    print(a_li.count(1)*2)

Solution (Python):
S = input()
count = 0
S = sorted(S)
if '1' in set(S):
  print(2*min(len(S[S.index('1'):]),len(S[:S.index('1')])))
else:
  print(2*min(len(S[S.index('0'):]),len(S[:S.index('0')])))

Solution (Python):
S = input()

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

Solution (Python):
S = list(input())
S_len = len(S)
one_num = len(list(filter(lambda x: x == '1', S)))
zero_num = S_len - one_num

print(min(one_num, zero_num) * 2)

Solution (Python):
S=input()
count=0
for i in S:
  count = count + 1 if i=='0' else count
print(min(count,len(S)-count)*2)

Solution (Python):
s = input()

zero = 0
one  = 0

for i in s:
    if i == "0":
        zero += 1
    else:
        one += 1

if zero <= one:
    print(zero*2)
else:
    print(one*2)

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

Solution (Python):

S=input()
a=''
c=0
for s in S:
	if a=='':
		a+=s
	elif a[-1:]!=s:
		a=a[:-1]
		c+=2
	else:
		a+=s
print(c)

Solution (Python):
n=input()
ans=0
chk=""
for i in n:
    if chk=="" or chk[-1]==i:
        chk+=i
    else:
        chk=chk[:-1]
        ans+=2

print(ans)

Solution (Python):
s = list(input())
count0 = 0
count1 = 0

for i in range(len(s)):
	if s[i] == '1':
		count1 += 1
	else:
		count0 += 1

print(2 * min(count0, count1))

Solution (Python):
from sys import stdin

s = list(map(int, list(stdin.readline().rstrip())))
print(min(s.count(1), s.count(0))*2)

Solution (Python):
from collections import deque
s = list(input())
queue = deque()
res = 0
count = 0
for c in s:
    queue.append(c)
    count += 1
    if count >= 2:
        if "0" == queue[-1] and "1" == queue[-2] or "0" == queue[-2] and "1" == queue[-1]:
             res += 2
             count -= 2
             queue.pop()
             queue.pop()
print(res)

Solution (Python):
S=input()
stack=[]
ans=0

for i in range(len(S)):
    if len(stack)==0:
        stack.append(S[i])
    elif stack[len(stack)-1]!=S[i]:
        stack.pop()
        ans+=2
    else:
        stack.append(S[i])

print(ans)

Solution (Python):
k = input()
z = k.count('0')
o = k.count('1')

if len(k) == 1:
    print(0)
else:
    if z == 0 or o == 0:
        print (0)
    else:
        if z < o:
            print(z*2)
        else:
            print(o*2)

Solution (Python):
s = input()
zero_num = s.count('0')
one_num = s.count('1')
if zero_num < one_num:
    print(zero_num * 2)
else:
    print(one_num * 2)

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

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

Solution (Python):
s = list(input())

s0 = 0
s1 = 0
for i in range(len(s)):
    if s[i] == '0':
        s0 += 1
    else:
        s1 += 1

ans = min(s0, s1) * 2
print(ans)

Solution (Python):
s = input()
n = len(s)
a = []
i = 0
ct = 0
for i in range(n):
  a.append(int(s[i]))
i = -1

while ct < 100000000000:
  n = len(a)
  i += 1
  if i >= n-1: break
  if a[i] == 0 and a[i+1] == 1:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i <= 1: i=-1
    continue
  elif a[i] == 1 and a[i+1] == 0:
    a.pop(i)
    a.pop(i)
    ct += 1
    i -= 2
    if i <= 1 :i = -1
    
print(ct*2)

Solution (Python):
S = input()
zenhan0 = 0
zenhan1 = 0
kouhan0 = 0
kouhan1 = 0
for i in range(len(S)//2):
  if S[i] == '0':
    zenhan0 += 1
  else:
    zenhan1 += 1 
for j in range(len(S)//2,len(S)):
  if S[j] == '0':
    kouhan0 += 1
  else:
    kouhan1 += 1
print(len(S)-abs(zenhan0-kouhan1)-abs(zenhan1-kouhan0))

Solution (Python):


"""
Created on 2019/3/3
Solved on 2019/3/3
@author: shinjisu
"""






def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]


def getIntMat(n):
    mat = []
    for i in range(n):
        mat.append(getIntList())
    return mat


def zeros2(n, m): return [zeros(m)]*n


ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**12


def dmp(x, cmt=''):
    global debug
    if debug:
        if cmt != '':
            print(cmt, ':  ', end='')
        print(x)
    return x


def prob_B():
    A, B, K = getIntList()
    dmp((A, B, K))
    count = 0
    i = 1
    while count < K:
        if A % i == 0 and B % i ==0:
            count += 1
            if count == K:
                break
        i += 1
    return i


def prob_C():
    S = input()
    red = 0
    blue = 0
    for cube in S:
        if cube == '0':
            red += 1
        else:
            blue += 1
    dmp((red, blue))
    return min(red, blue)*2


debug = False  
ans = prob_C()
print(ans)




def prob_D():
    N = getInt()
    A = getIntList()
    dmp((N, A))
    return 123


def prob_A():
    A, B, C = getIntList()
    dmp((A, B, C))
    count = min(B // A, C)
    return count

Solution (Python):
S = input()
N = len(S)
stack = []
for s in S:
    if stack and stack[-1] != s:
        stack.pop()
    else:
        stack.append(s)
print(N - len(stack))

Solution (Python):
temp = input()
cube = [int(part) for part in temp]
test = [0, 0]
for part in cube:
    test[part] += 1
print(min(test)*2)

Solution (Python):
s = input()
stack = []
for c in s:
    if not stack or stack[-1] == c:
        stack.append(c)
    else:
        stack.pop()
print(len(s)-len(stack))

Solution (Python):
a = input()

cnt0 = a.count("0")
cnt1 = a.count("1")

print(str(min(cnt0,cnt1)*2))

Solution (Python):



import sys
import math
from functools import lru_cache

s = list(input())
count = 0
for c in s:
    if c == '1':
        count += 1
    else:
        count -= 1

if count < 0:
    count *= -1

print(len(s) - count)

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

Solution (Python):
l = list(input())

num0 = 0
for i in range(0,len(l)):
    if l[i] == "0":
        num0 = num0 + 1

num1 = len(l) - num0

if num1 > num0:
    print(2*num0)
else:
    print(2*num1)

Solution (Python):
S = input()

Slist = sorted(S)
if Slist[-1]=="0":
    print(0)
else:
    zero = Slist.index("1")
    print(min(zero,len(Slist)-zero)*2)

Solution (Python):
S = input()
nof_0 = S.count("0")
nof_1 = S.count("1")
print(min(nof_0, nof_1) * 2)

Solution (Python):
S = input()
N = len(S)
zero = 0
one = 0
for i in range(N):
    if S[i] == "0":
        zero += 1
    else:
        one += 1
print(N-abs(zero-one))

Solution (Python):
S = input()

N = len(S)
zero = S.count('0')
one = S.count('1')
print(N - abs(zero - one))

Solution (Python):
s = input()
a = s.count("0")
b = s.count("1")
if len(s)==a or len(s)==b:
    print(0)
else:
    print(min(a,b)*2)

Solution (Python):
def solve():
    s = raw_input().strip()
    counter = [0, 0]
    for ch in s:
        counter[int(ch)] += 1

    diff = abs(counter[1] - counter[0])
    print len(s) - diff


if __name__ == '__main__':
    solve()

Solution (Python):
S = raw_input()
print len(S) - abs(S.count('0') - S.count('1'))

Solution (Python):
s = [int(i) for i in list(input())]
n = len(s)

blue = sum(s)
red = n - blue

ans = min(red,blue)*2

print(ans)

Solution (Python):
temp = input()
cube = [int(part) for part in temp]

one = 0
zero = 0
for part in cube:
    if part:
        one += 1
    else:
        zero += 1

print(min(one, zero)*2)

Solution (Python):
s = input()

n0 = 0
n1 = 0
ans = 0

for i in s:
    if i == "0":
        if n1 == 0:
            n0 += 1
        else:
            n1 -= 1
            ans += 2
    else:
        if n0 == 0:
            n1 += 1
        else:
            n0 -= 1
            ans += 2

print(ans)

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

Solution (Python):
S = input()

n_zero = 0
n_one = 0

for char in S:
    if char == "0":
        n_zero += 1
    else:
        n_one += 1

out = min(n_zero, n_one) * 2
print(out)

Solution (Python):
st = input()
countone = st.count('1')
countzero = st.count('0')
if countone > countzero and countzero > 0:
    print(countzero*2)
elif countone <= countzero and countone > 0:
    print(countone*2)
else:
    print('0')

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

Solution (Python):
def main():
    S = input()
    print(min(S.count('0'), S.count('1')) * 2)


main()

Solution (Python):
s = input()

zero = 0
one = 0

for c in s:
  if c == '0':
    zero += 1
  elif c == '1':
    one += 1
    
print((zero + one - abs(one - zero)))

Solution (Python):

S=input()
zero=0
one=0
for i in range(len(S)):
    if S[i]=="0":
        zero+=1
    else:
        one+=1

print(2*min(zero,one))

Solution (Python):
S = input()
N = len(S)
one = 0

for i  in range(N):
    one += int(S[i])

zero = N-one

print(2*min(one,zero))

Solution (Python):
s = list(sorted(str(input())))
print(min(s.count("0"),s.count("1"))*2)

Solution (Python):
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
nzero = s.count("0")
none = s.count("1")
print(len(s) - abs(nzero-none))

Solution (Python):

S = input()

count0 = 0
count1 = 0

for i in range(len(S)):
    if S[i] == "0":
        count0 += 1
    elif S[i] == "1":
        count1 += 1

print(int(min(count0, count1)*2))

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

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

Solution (Python):
s=list(input())
n=len(s)
c0=0
c1=0
for i in range(n):
    if s[i]=='0':
        c0+=1
    else:
        c1+=1
print(min(c0,c1)*2)

Solution (Python):
s=input()
count0=0
count1=0
for i in range(len(s)):
	if s[i]=='0':
		count0+=1
	else:
		count1+=1
print(min(count0,count1)*2)

Solution (Python):
S = input()

stack = []
for s in S:
    if stack and stack[-1] != s:
        stack.pop()
    else:
        stack.append(s)
print(len(S) - len(stack))

Solution (Python):
s = input()
z = s.count("0")
o = len(s)-z
print(min(z, o)*2)

Solution (Python):
S = input()
s = list(S)

zero = s.count("0")
one = s.count("1")
if(len(S) == 1):
  if(zero == 1 or one == 1):
    print(0)
elif(zero > one):
  print(one*2)
elif(zero < one):
  print(zero*2)
else:
  print(zero*2)

Solution (Python):
s = input()
a = s.count("0")
b = s.count("1")
print(2*(a if a<b else b))

Solution (Python):
l=list(input())
a=l.count('0')
b=l.count('1')
print(min(a,b)*2)

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

Solution (Python):
S = list(input())
count_0 = S.count("0")
count_1 = S.count("1")

print(min(count_0,count_1) * 2)

Solution (Python):
s=input()
z=0
o=0
for i in range(len(s)):
    if s[i]=="0":
        z+=1
    else:
        o+=1
print(len(s)-abs(o-z))

Solution (Python):
S = input()
zero = 0
one = 0
for i in S:
    if int(i) == 0:
        zero += 1
    else:
        one += 1
print(len(S) - abs(zero - one))

Solution (Python):
S = input()
no1 = S.count('1')
no0 = S.count('0')
print(len(S) - abs(no1 - no0))

Solution (Python):
s = input()
s_0, s_1 = 0, 0
for i in s:

    if str(0) in i:
        s_0 += 1
    elif str(1) in i:
        s_1 += 1
print(min(s_0, s_1) * 2)

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

Solution (Python):
s=input().count;print(min(s('0'),s('1'))*2)

Solution (Python):
s = list(input())
i = 1
count = 0
while i != len(s):
  if i == 0:
    i += 1
  elif s[i-1] != s[i]:
    del s[i]
    del s[i-1]
    i -= 1
    count += 2
  else:
    i += 1

print(count)

Solution (Python):
l=list(input())
count=0
s=set()
arr=[]
val=0
while True:
    for i in range(len(l)):
        if(l[i]=='0'):
            val+=1
        if(len(arr)>0 and i not in s and((arr[-1]=='1' and l[i]=='0') or (arr[-1]=='0' and l[i]=='1'))):
            del arr[-1]
            count+=2
        else:
            arr.append(l[i])
            s.add(i)
    if(val==l.count('0')):
        break
    
print(count)

Solution (Python):
import numpy as np
S = str(input())
array = np.array([int(i) for i in S])

num_1 = sum(array)
num_0 = len(array) - num_1

nokori = max(num_1, num_0) - min(num_1, num_0)
answer = len(array) - nokori
print(answer)

Solution (Python):
s=raw_input()

r=0	
b=0	

for x in s:
	if x=="0": r+=1
	else:	b+=1

print min(b,r)*2

Solution (Python):
s=input()
zero_c=s.count('0')
one_c=s.count('1')
print(min(zero_c,one_c)*2)

Solution (Python):

s = str(input())
sl = list(s)
count0 = sl.count('0')
count1 = sl.count('1')

print(min(count0, count1) * 2)

Solution (Python):
S = [int(e) for e in input()]
res = min(sum(S), len(S) - sum(S))
print(res*2)

Solution (Python):




s = input()

rcnt = 0
bcnt = 0


for idx in range(len(s)):
    if int(s[idx]) == 0:
        rcnt += 1
    else:
        bcnt += 1


rem = abs(rcnt - bcnt)
ans = len(s) - rem


print(ans)

Solution (Python):
s = input()
cube_list = [s[0]]
s = s[1:]
count = 0
for c in s:
    if cube_list:
        if cube_list[-1] == c:
            cube_list.append(c)
        else:
            count += 2
            cube_list.pop(-1)
    else:
        cube_list.append(c)
print(count)

Solution (Python):
s = str(input())
count0 = s.count('0')
count1 = s.count('1')

print(len(s)-abs(count0-count1))

Solution (Python):
S=input()
lenS=len(S)
ls=[]
ls.append(S[0])
for i in range(1,lenS):
	if len(ls)==0:
		ls.append(S[i])
		continue
	tmp=ls.pop(-1)
	if tmp==S[i]:
		ls.append(tmp)
		ls.append(S[i])
print(lenS-len(ls))

Solution (Python):
S = input()

print(len(S)-abs(S.count('1')-S.count('0')))

Solution (Python):
S = [int(c) for c in input()]
Blue = S.count(0)  
Red = S.count(1)
Rest = abs(Red-Blue)
print(len(S)-Rest)

Solution (Python):
s = input()

def dec(n):
    if n == '0':
        return -1
    else:
        return 1

ls = [dec(el) for el in s]
print(len(ls) - abs(sum(ls)))

Solution (Python):
"""
C - Unification

どんな状況でも赤青両方のブロックが1つ以上存在しているなら赤青となりあう箇所が最低1か所存在する.
→ 赤青どちらかのブロックがなくなるまでブロックを2つずつ取り除くことができる.
"""


def solve():
    S = input()
    zero_num = S.count('0')
    one_num = S.count('1')
    ans = zero_num * 2 if zero_num < one_num else one_num * 2
    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
S = input()

zero_cnt = S.count('0')
one_cnt = S.count('1')

print(min(zero_cnt, one_cnt) * 2)

Solution (Python):
from sys import stdin
N=(stdin.readline().rstrip())
zero=list(N).count("0")
one=list(N).count("1")
ans=min(zero*2,one*2)
print(ans)

Solution (Python):
s=input()

zero_num = 0
one_num = 0
for i in range(len(s)):
    if s[i] == '1':
        one_num+=1
    else:
        zero_num+=1

print(2*min(zero_num,one_num))

Solution (Python):
from collections import deque

S = input()

print(len(S) - abs(S.count("0") - S.count("1")))

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    s = input()
    zeros = s.count('0')
    ones = s.count('1')
    print(min(zeros, ones) * 2)


main()

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

Solution (Python):
s = input()
a = s.count('0')
b = s.count('1')
if (a > b) == True:
  print(b * 2)
else:
  print(a * 2)

Solution (Python):
S = input()
arr = list(S)

red = arr.count('0')
blue = arr.count('1')

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

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

Solution (Python):
S = input()

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

print(min(a,b)*2)

Solution (Python):
S = input()

if S.count('0') == 0 or S.count('1') == 0:
    print(0)
elif S.count('0') > S.count('1'):
    print(2 * S.count('1'))
else:
    print(2 * S.count('0'))

Solution (Python):
S = str(input())

Zero = S.count("0")
One  = S.count("1")

print(2*min([Zero , One]))

Solution (Python):

"""
Created on Sun Mar  3 19:52:53 2019

@author: Yamazaki Kenichi
"""
from collections import deque

S = input()

ans = 0
q=deque([' '])
for c in S:
    tmp = q.pop()
    s = tmp+c
    if s.count('0') >= 1 and s.count('1') >= 1:
        ans += 2
    else:
        q.append(tmp)
        q.append(c)
print(ans)

Solution (Python):
s=input()
a=s.count("1")
b=s.count("0")
print(a*2) if a<b else print(b*2)

Solution (Python):
from sys import stdin

sl = [int(i) for i in stdin.readline().rstrip()]
zcount = 0
ocount = 0
for i in sl:
    if i == 0:
        zcount += 1
    else:
        ocount += 1
print(min(ocount,zcount)*2)

Solution (Python):

s = input()

ma = 0
l = s[0]
an = 0


ar = [-11,s[0]]
ans = 0
for i in range(1,len(s)):
    
    if int(s[i])+int(ar[len(ar)-1])==1:
        ar.pop()
        ans+=2
    else:
        ar.append(s[i])
print(ans)

Solution (Python):
S = str(input())
N = len(S)
cube = list(S)
ary = []

for s in cube:
    if len(ary) == 0:
        ary.append(s)
        continue
    if ary[-1] == s:
        ary.append(s)
    else:
        ary.pop()
print(len(cube) - len(ary))

Solution (Python):


S = list(input())

n1 = sum(s == "1" for s in S)
n0 = sum(s == "0" for s in S)

print(len(S) - abs(n1 - n0))

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

Solution (Python):
S = list(input())
num0=0
for i in range(len(S)):
  if S[i]=="0":
    num0+=1
num1=len(S)-num0
print(min(num0,num1)*2)

Solution (Python):
S = input()
red,blue=0,0
for c in S:
    if c == '0':
        red += 1
    else:
        blue += 1
print(min(red,blue) * 2)

Solution (Python):
s = input()
red, blue = 0, 0
for c in s:
    if c=="0":
        red += 1
    elif c=="1":
        blue += 1

print(min(red, blue)*2)

Solution (Python):
S = list(input())
lop = 0
cnt = 0
fg = True

while(True):
    if len(S) < 2:
        break

    if not S[lop] == S[lop+1]:
        cnt += 2
        S.pop(lop+1)
        S.pop(lop)
        fg = False
        if not lop == 0:
            lop -= 1
    else:
        lop += 1
    
    
    if lop == len(S)-1:
        if fg == True:
            break
        else:
            lop = 0
            fg = True

print(cnt)

Solution (Python):
s = input()





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

Solution (Python):
import queue
q=queue.Queue()
s=list(input())
c=0
for i in s:
  if q.empty():
    q.put(i)
  else:
    a=q.get()
    if a!=i:
      c+=2
    else:
      q.put(a)
      q.put(i)
print(c)

Solution (Python):
s = list(input())
n0 = s.count('0')
n1 = s.count('1')
print(min(n0,n1)*2)

Solution (Python):
str0 = input()

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

Solution (Python):
s = input()

num_0 = s.count("0")
num_1 = s.count("1")
if num_0 < num_1:
    print(num_0*2)
else:
    print(num_1*2)

Solution (Python):
S = input()
print(min(sum([1 for s in S if s == "0"]),sum([1 for s in S if s == "1"]))*2)

Solution (Python):
S = input()

num_1 = 0
for s in S:
    if s is '1':
        num_1 += 1

num_0 = len(S) - num_1

print(len(S)-abs(num_0-num_1))

Solution (Python):
S = input()


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

Solution (Python):
S = input()
count0 = 0
count1 = 0
for x in S:
    if x == '0':
        count0 += 1
    else:
        count1 += 1
print(min(count0, count1) * 2)

Solution (Python):
s = list(map(int, list(input())))
print(min(len(s) - sum(s), sum(s)) * 2)

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

S = S()









result = 0

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

Solution (Python):
S = input()

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

print(len(S) - abs(zero - one))

Solution (Python):
S = input()

red_num = 0
blue_num = 0

for s in S:
    if s == '0':
        red_num = red_num + 1
    elif s == '1':
        blue_num = blue_num + 1

print(min(red_num, blue_num) * 2)

Solution (Python):
s = input()
one = s.count("1")
zero = s.count("0")
answer = len(s)-abs(one-zero)
print(answer)

Solution (Python):
s = str(input())
figure1 = s.count('0')
figure2 = s.count('1')
print(min(figure1, figure2)*2)

Solution (Python):
S = input()
s = abs(S.count("0") - S.count("1"))
print(len(S) - s)

Solution (Python):


import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S=input()

cnt1=S.count('0')
cnt2=S.count('1')

print(len(S)-abs(cnt1-cnt2))

Solution (Python):
s2 = list(input())
n = len(s2)
s = [0]*n
for i in range(n):
    s[i] = int(s2[i])

fi = s.count(0)
se = s.count(1)
print(min(fi,se)*2)

Solution (Python):
import sys
input = sys.stdin.readline
s = input()
n = len(s)
ok = 0
while ok == 0:
    ok = 1
    i = 0
    while i < len(s) - 1:
        str = s[i] + s[i+1]
        j = 0
        while str == "01" or str == "10":
            s = s[:i-j] + s[i+2-j:]
            ok = 0
            j += 1
            if i > j + 1:
                str = s[i-j] + s[i-j+1]
            else:
                break
        i += 1
print(n - len(s))

Solution (Python):
S = input()

num_one = S.count('1')
num_zero = S.count('0')

print(min(num_one, num_zero) * 2)

Solution (Python):
S = input()
N = len(S)
n0 = S.count('0')
n1 = N-n0
print(min(n0,n1)*2)

Solution (Python):
s = list(map(int, list(input())))
print(min(abs(len(s) - sum(s)), sum(s)) * 2)

Solution (Python):
a = input()
zero = a.count("0")
one = a.count("1")
print(min(zero, one) * 2)

Solution (Python):
S=input();
print(min(S.count('0'),S.count('1'))*2)

Solution (Python):
def main():
    s = input()
    b0 = s.count("0")
    b1 = s.count("1")
    m = min(b0, b1)
    print(m * 2)

main()

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

Solution (Python):
s = input()
x=0
for i in s:
	if(i=='0'):x+=1
	elif(i=='1'):x-=1

print(len(s)-abs(x))

Solution (Python):
s = input()

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

Solution (Python):
S = input().strip()
print(min(S.count('0'), S.count('1')) * 2)

Solution (Python):

S=input()
r=0
b=0
for c in S:
    if c=='0':
        r+=1
    else:
        b+=1
print(2*min(r,b))

Solution (Python):
stack = []
Q = input()
for q in Q:
    if stack and stack[-1]!=q:
        stack.pop()
    else:
        stack.append(q)

print(len(Q)-len(stack))

Solution (Python):
S = input()

from collections import deque

q = deque([]) 

c = 0
for s in S:
    if len(q) == 0:
        q.append(s)
    else:
        p = q.pop()
        if s == p:
            q.append(s)
            q.append(s)
        else:
            c = c + 2
            
print(c)