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):
s=input()
print(2*min(s.count("0"),s.count("1")))

Solution (Python):
a=list(input())
b=a.count("0")
min_count=2*min(b,len(a)-b)
print(min_count)

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

Solution (Python):

from collections import deque

S = input()




que = deque()
res = 0
for d in S:
    if len(que) == 0:
        que.append(d)
    elif que[-1] != d:  
        res += 2
        que.pop()   
    else:
        que.append(d)

print(res)

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

Solution (Python):
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
s=S()
r=s.count("0")
b=len(s)-r
print(min(r,b)*2)

Solution (Python):
import re

s = input()
zero = re.findall("0", s)
one = re.findall("1", s)
print(2 * min(len(zero), len(one)))

Solution (Python):
S=input()

li = [s for s in list(S)]

if (li.count("1") > li.count("0")):
    print(li.count("0")*2)
else:
    print(li.count("1")*2)

Solution (Python):
s=input()
n0=0
n1=0
for i in s:
    if i=="0":
        n0+=1
    else:
        n1+=1
print(2*min(n0,n1))

Solution (Python):
l = raw_input().split()
s = l[0]

def get_removals(s):
    ret = []
    for i in range(len(s) - 1):
        if int(s[i]) + int(s[i + 1]) == 1:
            ret.append(i)
    return ret

def remove(s, index):
    if index == 0:
        return s[2:]
    if index == (len(s) - 1):
        return s[:index-1]
    return  s[0:index] + s[index + 2:]

num_removals = []

ones = 0
zeros = 0
for num in s:
    if num == '0':
        ones += 1
    if num == '1':
        zeros += 1
max_candidate = min(ones, zeros) * 2

def process(s, count):
    removals = get_removals(s)
    if len(removals) == 0:
        num_removals.append(count)
        if count == max_candidate:
            print(max_candidate)
            exit()
        return
    count += 2
    max_remove = 0
    ss = []
    for removal in removals:
        s1 = remove(s, removal)
        ss.append(s1)
        num_removes = len(get_removals(s1))
        if max_remove < num_removes:
            max_remove = num_removes
    for s1 in set(ss):
        if len(get_removals(s1)) == max_remove:
            process(s1, count)


print(max_candidate)

Solution (Python):
S = list(map(int,input()))
num1 = 0
num0 = 0

for i in range(len(S)):
    if S[i]:
        num1 += 1
    else:
        num0 += 1

print(min(num1,num0)*2)

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

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

Solution (Python):
s=str(input())
s=list(s)
l=[]
for i in s:
	l.append(int(i))
c=0
d=0
for i in l:
    if i==0:
        c+=1
    else:
        d+=1

ans=2*min(c,d)
print(ans)

Solution (Python):
from collections import Counter as C
a=C(input())
print(min(a["0"],a["1"])*2)

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

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

Solution (Python):
S = str(input())
s = S
cont0 = s.count('0')
cont1 = s.count('1')
if cont0 > cont1:
    print(cont1 * 2)
else:
    print(cont0 * 2)

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

if count0 >= count1:
    print(count1*2)
else:
    print(count0*2)

Solution (Python):
li = list(map(int,input()))
count0 = li.count(0)
count1 = li.count(1)
print(min(count0,count1)*2)

Solution (Python):
s = input()

if '1' in s and '0' in s:
    print(min(s.count('1'),s.count('0'))*2)
else:
    print(0)

Solution (Python):
from collections import Counter


def main():
    S = input()

    ans = f(S)
    print(ans)


def f(S):
    c = Counter(S)
    return min(c['0'], c['1']) * 2


if __name__ == '__main__':
    main()

Solution (Python):
from collections import deque
import copy
S = deque(input())
S2 = deque([])
counter = 0
while True:
    flag = True
    while True:
        if len(S) == 0:
            break
        s = S.popleft()
        if len(S2) == 0:
            S2.append(s)
            flag = False
            continue
        
        elif s!=S2[-1]:
            S2.pop()
            flag = False
            counter +=2
        else:
            S2.append(s)
    
    if flag:
        break
    else:
        S = copy.deepcopy(S2)
print(counter)

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

Solution (Python):
S = list(input())
a=0
b=0
x=0

for h in range(len(S)):
	if S[h]=="1":
		a=a+1
	else:
		b=b+1

print(a*2 if a<b else b*2)

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

Solution (Python):

S = input()
SL = list(map(int, list(S)))

ones = sum(SL)
zeros = len(SL) - ones
ans = min(ones, zeros) * 2
print(ans)

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

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

Solution (Python):
from collections import Counter


def main():
    S = list(input())
    c = Counter(S)
    print(len(S) - abs(c['0'] - c['1']))


if __name__ == "__main__":
    main()

Solution (Python):
inData = str(input())
ansList = []
dataLen = len(inData)
zeroCnt = 0
oneCnt = 0
for i in range(0, dataLen):
    if inData[i] == '0':
        zeroCnt += 1
    else:
        oneCnt += 1

print(2 * min([zeroCnt, oneCnt]))

Solution (Python):
cubes= list(input())
one=0
zero=0

for i in cubes:
  if i=='1':
    one+=1
  else:
    zero+=1
if one>= zero:
  print(zero*2)
else:
  print(one*2)

Solution (Python):
import collections
s=list(map(str,input()))
c=collections.Counter(s)
print(2*min(c["1"],c["0"]))

Solution (Python):
S = str(input())
count_0 = 0
count_1 = 0
for i in range(len(S)):
  if int(S[i]) == 0:
    count_0 += 1
  else:
    count_1 += 1
print((min(count_0,count_1))*2)

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

Solution (Python):


S = input()




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

fin = abs(c0-c1)    
res = len(S) - fin

print(res)

Solution (Python):
S = input()

count_0 = S.count('0')
count_1 = S.count('1')

print(min(count_0, count_1) * 2)

Solution (Python):
s = str(input())
if s.count("0") > 0 and s.count("1") > 0:
    print(2*min(s.count("0"),s.count("1")))
else:
    print(0)

Solution (Python):

S = input()
work=list(S)
i=0
o_cout=0
z_cout=0
for x in work:
    if(x=='1'):
        o_cout+=1
    else:
        z_cout+=1
    
if(o_cout>z_cout):
    cout=z_cout
else:
    cout=o_cout
    

print(cout*2)

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

Solution (Python):
























def inpl(): return list(map(int, input().split()))

S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")

print(2*min(c0, c1))

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

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

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

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

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

Solution (Python):
s = input()
a = s.count('1')
b = s.count('0')

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

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

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

Solution (Python):
s = input()
one = s.count('1')
zero = s.count('0')

print(min(one, zero)*2)

Solution (Python):
from collections import Counter
c = Counter(input())
print(2*min(c['0'], c['1']))

Solution (Python):
S = list(map(int, list(input())))

if 0 not in S:
    print(0)

elif 1 not in S:
    print(0)

else:
    zeros = S.count(0)
    ones = S.count(1)
    if zeros > ones:
        print(ones * 2)
    else:
        print(zeros * 2)

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

Solution (Python):
import numpy as np

S = np.array(list(map(int, input())))

n0 = (S == 0).sum()
n1 = (S == 1).sum()

print(min(n0, n1) * 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 = input()

S = [s for s in S]
S = [int(s, 0) for s in S]
S.sort()
if 1 in S and  0 in S:
    print(min(S.count(0)*2,S.count(1)*2))
else:
    print(0)

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

Solution (Python):
s=input()
ind=0
ret=0
while ind < len(s)-1:
  if s[ind]!=s[ind+1]:
    s=s[:ind]+s[ind+2:]
    
    ret+=2
    if ind > 0:
      ind-=1
  else:
    ind+=1
print(ret)

Solution (Python):
S=input()
if S.count("1")>=S.count("0"):
  print(S.count("0")*2)
else:
  print(S.count("1")*2)

Solution (Python):
S = list(input())
N = len(S)

c=0
i=0
f=0
while(1):
    if i+1 == N or N < 2:
        break
    if S[i] != S[i+1]:
        del S[i:i+2]
        c += 2
        N -= 2
        if i >= 1:
            i -= 2
        else:
            i -= 1
    i += 1
    
print(c)

Solution (Python):

import copy
import numpy as np
import random




s = list(str(input()))


count = [0,0]
for i in range(len(s)):
    count[int(s[i])] += 1

ans = 2*min(count[0],count[1])

print(ans)

Solution (Python):
s=input()
n_0=0
n_1=0
ans=0

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

ans=min(n_0*2,n_1*2)
print(ans)

Solution (Python):
S = list(input())
N = len(S)
num0 = 0
for i in range(N):
	if S[i] == '0':
		num0 = num0 + 1

num1 = 0
for i in range(N):
	if S[i] == '1':
		num1 = num1 + 1
print(N - abs(num0 - num1))

Solution (Python):
import numpy as np
s = np.array(list(input()))

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

Solution (Python):
import re

tmp = raw_input()

length = len(tmp)


tmp1 = tmp.replace("0", "")
tmp2 = tmp.replace("1", "")

if len(tmp1) > len(tmp2):
    tmp3 = len(tmp1) - len(tmp2)

else:
    tmp3 = len(tmp2) - len(tmp1)


division = length - tmp3

print(division)

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

Solution (Python):
cin = input()
count_0 = 0
count_1 = 0
for i in range(len(cin)):
  if int(cin[i]) == 0:
    count_0 = count_0 + 1
  else:
    count_1 = count_1 + 1
m = min(count_0,count_1)
ans = m*2
print(ans)

Solution (Python):


from sys import stdin

input = stdin.readline

S = input().rstrip()

Nblock = min(S.count('1'), S.count('0'))

print(Nblock*2)

Solution (Python):


from sys import stdin





import numpy as np


data = stdin.readline().split()
data=str(data)
data2=[]
for a in data[2:-2]:
    data2.append(int(a))
data=data2

start = data[0]
count=0
for i, c in enumerate(data):
    
    if i == len(data)-1:
        break
    
    if c==start and data[i+1]==start:
        count+=2
        
    
    if i!=0:
        if c==data[i-1]==data[i+1]:
            count+=2
            start=c

count0=0
for i, c in enumerate(data):
    if c==0:
        count0+=1
count1=len(data)-count0

if count1>count0:
    print(len(data)-(count1-count0))
else:
    print(len(data)-(count0-count1))

Solution (Python):
s = input()
ones = [1 for x in s if x=="1" ]
print(min(len(ones),len(s)- len(ones))*2)

Solution (Python):
s = 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):
data=input()
n1 = data.count('1')
n0 = data.count('0')
print(min(n1, n0) * 2)

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

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

a=N.count('1')
b=N.count('0')
if a < b:
    print(a*2)
elif a >= b:
    print(b*2)

Solution (Python):

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

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

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

Solution (Python):

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

print(ans)

Solution (Python):
S = [int(_) for _ in input()]
length = len(S)
temp = [S[0]]
for x in S[1:]:
    if(len(temp) == 0):
        temp.append(x)
    elif( temp[-1] == x):
        temp.append(x)
    else:
        temp.pop(-1)
print(length-len(temp))

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

Solution (Python):


S = list(map(int, input()))
N = len(S)

zero = len([s for s in S if s == 0])
one = len([s for s in S if s == 1])
print(len(S) - abs(zero - one))

Solution (Python):
def spaceinput():
    return list(map(int,input().split(" ")))



s=input()

s=list(s)

n1=0
n0=0

for ss in s:
    if ss=='0':
        n0+=1
    else:
        n1+=1
    
print(min(n0,n1)*2)

Solution (Python):
s = input()

zero = 0
one = 0

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

print(min(zero, one) * 2)

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

zerocnt = s.count('0')
onecnt = len(s) - zerocnt
if zerocnt <= onecnt:
  print(zerocnt * 2)
else:
  print(onecnt * 2)

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

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

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

c1 = sl.count('1')
c0 = sl.count('0')

r = abs(c1-c0)

print(len(s)-r)

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

a = [int(x) for x in S]
b = min(a.count(0), a.count(1))

print(b * 2)

Solution (Python):
inp = input()
le = len(inp)
ze =0
ic = 0


k = list(inp)
for f in k:
  if f == "0":
    ze += 1
  else:
    ic += 1
m = le - abs(ze-ic)
print(m)

Solution (Python):
string = input()
str_lis = list(string)
num_lis = [int(x) for x in str_lis]
s = sum(num_lis)
l = len(num_lis)
d = l - s
x = min(s, d)
print(x * 2)

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

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

Solution (Python):
S=input()

zero_count=0
one_count=0
for c in S:
    if c=='1':
        one_count+=1
    else:
        zero_count+=1

print(min(zero_count,one_count)*2)

Solution (Python):
x = input()
cnt1 = 0
cnt2 = 0
for i in x:
  if i == '1':
    cnt1 += 1
  else:
    cnt2 += 1
print(min(cnt1, cnt2)*2)

Solution (Python):
str = input()
num0,num1 = 0,0
for i in range(len(str)):
	if str[i] == '0':
		num0 += 1
	elif str[i] == '1':
		num1 += 1
if num1 >= num0:
	count = num0*2
	print(count)
else:
	count = num1*2
	print(count)

Solution (Python):
S = input()
 
num_0 = S.count('0')
num_1 = S.count('1')

print(min(num_0, num_1) * 2)

Solution (Python):
nums=str(input())
arr=list(map(int,nums))
l=len(arr)
a=0
i=0
while i<len(arr)-1:
    if i<0:
        i=0
    if arr[i]!=arr[i+1]:
        del arr[i:i+2]
        
        a+=2
        i-=2
    i+=1
print(a)

Solution (Python):
S = list(input())
SL = len(S)
L = len(S)
i = 1
while len(S)>1 and i<len(S):
  if int(S[i]) != int(S[i-1]):
    S.pop(i-1)
    S.pop(i-1)
    i-=1
  else:
    i+=1
  if i==0:
    i+=1
print(L-len(S))

Solution (Python):
in_s = input().rstrip()
lst = list(in_s)
cur=0
while True:
    if cur+1 >= len(lst):
        break
    if lst[cur]!=lst[cur+1]:
        del lst[cur+1]
        del lst[cur]
        cur = max(0,cur-1)
    else:
        cur+=1
 
print(len(in_s) - len(lst))

Solution (Python):
def main():
    S = input()
    
    one = S.count("1")
    zero = len(S) - one
    
    print(min(zero,one)*2)
    
main()

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

Solution (Python):
P=map(int,list(raw_input()));print min(sum(P),len(P)-sum(P))*2

Solution (Python):

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

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

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

Solution (Python):
S = list(map(int, input()))
ans = 0
l = len(S)
i = 0
while len(S)-1 > i:
    if S[i] != S[i+1]:
        S.pop(i)
        S.pop(i)
        ans += 2
        if i == 0:
            i -= 1
        else:
            i -= 2
    i += 1


print(ans)

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

Solution (Python):
s = input()
li = []
for i in range(len(s)):
	li.append(s[i])
cnt0 = li.count("0")
cnt1 = li.count("1")
print(cnt0*2 if cnt0 < cnt1 else cnt1*2)

Solution (Python):
import sys
input = sys.stdin.readline
s = input().rstrip()
 
if s.count("0") != 0 and s.count("1") != 0:
    if s.count("0") > s.count("1"):
        print(2*s.count("1"))
    elif s.count("1") > s.count("0"):
        print(2*s.count("0"))
    else:
        print(len(s))
else:
    print(0)

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

S = list(map(int, input().replace('\n', '')))

N = len(S)
stack = []
cnt = 0
index = N - 1
while index > -1:
    if(len(stack) == 0):
        stack.append(S.pop())
        index -= 1
    else:
        if stack[-1] != S[index]:
            stack.pop()
            S.pop()
            index -= 1
            cnt += 2
        else:
            stack.append(S.pop())
            index -= 1
print(cnt)

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

S = input()
stack = []
ans = 0
for ch in S:
    if len(stack) == 0 or stack[-1] == ch:
        stack.append(ch)
    else:
        ans += 2
        
        del stack[-1]
print(ans)

Solution (Python):
import sys

s = str(sys.stdin.readline())
c0 = s.count('0')
c1 = s.count('1')
r = c0 if c0 < c1 else c1
print(r*2)

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

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

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

Solution (Python):
S = input()
cnt = [0] * 2
for c in S:
    if c == '0':
        cnt[0] += 1
    else:
        cnt[1] += 1
print(min(cnt) * 2)

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

Solution (Python):
S = input()

nums = []
for s in S:
    nums.append(int(s))

count = 0
i = 0
while i < len(nums)-1:
    if nums[i] != nums[i+1]:
        nums.pop(i+1)
        nums.pop(i)
        count += 1
        if i != 0:
            i -= 1
        continue
    i += 1

print(count*2)

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

Solution (Python):
s = input()

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

Solution (Python):
N = input()
n = list(map(int, list(N)))

def solve():
    ones = sum(n)
    zeros = len(n) - ones
    return len(n) - abs(ones - zeros)

print(solve())

Solution (Python):
import sys

def parse(inp):
    S=list(next(inp))
    return S
  
def main(inp):
    S = inp
    zeros=0
    ones=0
    for i in range(len(S)):
        if(S[i]=='0'): zeros+=1
        elif(S[i]=='1'): ones+=1
            
    return 2*min(ones,zeros)
  
print(main(parse(sys.stdin)))

Solution (Python):
inp = input()

cnt_0 = inp.count('0')
cnt_1 = inp.count('1')

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

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

Solution (Python):
Ss = input()

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

print(len(Ss) - len(stack))

Solution (Python):
S=input()

count0=0
count1=0


for s in S:
	if s == '0':
		count0 += 1
	else:
		count1 += 1

print(min(count0,count1) * 2)

Solution (Python):


def _main():
    text = input()

    zero_count = text.count('0')
    one_count = len(text) - zero_count

    ans = min(zero_count, one_count) * 2

    print(ans)



if __name__ == '__main__':
    _main()

Solution (Python):
S = input()

c0=0
c1=0
for i in S:
  if i == '0':
    c0+=1
  else:
    c1+=1

print(2*min(c0,c1))

Solution (Python):
s = input()
cnt = 0

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




print(min(a,b) * 2)
exit()
while '10' in s:
    ind = s.find('10')
    temp = []
    temp.append(str(s[0:ind]))
    temp.append(str(s[ind + 2:len(s)]))
    
    s = "".join(temp)
    cnt = cnt + 2

while '01' in s:
    ind = s.find('01')
    
    temp = []
    temp.append(str(s[0:ind]))
    temp.append(str(s[ind + 2:len(s)]))
    s = "".join(temp)
    
    cnt = cnt + 2

print(cnt)

Solution (Python):
S = input()
len_S = len(S)
zero_lst = [S[i] for i in range(len_S) if S[i] == "0"]
one_lst = [S[i] for i in range(len_S) if S[i] == "1"]
ans = min(len(zero_lst), len(one_lst)) * 2
print(ans)

Solution (Python):
from collections import Counter
s = list(input())
d = Counter(s).most_common(2)


if len(d) == 1:
    print(0)
else:
    print(min(d[0][1],d[1][1])*2)

Solution (Python):
s=input()
li=list(s)
r=0
b=0
for i in li:
  if i=='0':
    r+=1
  if i=='1':
    b+=1
if r>b:
  print(b*2)
else:
  print(r*2)

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

Solution (Python):
N = input()
x0 = 0
x1 = 0

Ni = [int(s) for s in N]


for x in range(len(N)):
    if Ni[x] == 0:
        x0 += 1
    elif Ni[x] == 1:
        x1 += 1

print(min([x0, x1])*2)

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

Solution (Python):
s = list(map(int, input()))
c1,c0=0,0
for i in s:
  if i==1:
    c1+=1
  if i==0:
    c0+=1  
print(len(s)-abs(c1-c0))

Solution (Python):
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)

Solution (Python):
s = input()
length=len(s)


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

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

Solution (Python):
c = input()

zcount = 0
ocount = 0
for i in range(len(c)):
    
    if c[i] == '0':
        zcount += 1
    else:
        ocount += 1
print(2 * min(zcount, ocount))

Solution (Python):
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b


from collections import Counter

cnt = Counter()
s = input()
for c in s:
    cnt[c] += 1

if len(cnt.keys()) == 1:
    print(0)
else:
    print(min(cnt.values()) * 2)

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

Solution (Python):
s = str(input())
q = s[0]
for c in s[1:]:
    if len(q) >= 1:
        if q[-1] != c:
            q = q[:-1]
        else:
            q += c
    else:
        q += c
print(len(s) - len(q))

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

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

Solution (Python):
S = input()
z_cnt = 0
o_cnt = 0
for i in S:
    if i == '0':
        z_cnt += 1
    if i == '1':
        o_cnt += 1
print(len(S)-(max(z_cnt,o_cnt)-min(z_cnt,o_cnt)))

Solution (Python):
S = input()

save = []
flag = False
modori_flag = False
count = 0
for idx, s in enumerate(S):
    if modori_flag:
        modori_flag = False
    elif flag:
        flag = False
        continue
            
    this_ = int(s)
    if len(save) > 0 and this_ + save[-1] == 1:
        modori_flag = True
        del save[-1]
        count += 2
        continue
    if idx == len(S) -1:
        break
    next_ = int(S[idx+1])
    if this_ + next_ == 1:
        flag = True
        count += 2
        continue
        
    save.append(this_)
    
print(count)

Solution (Python):
s = input()

n = len(s)

red = 0
blue = 0
for v in s:
    if v == '0':
        red += 1
    else:
        blue += 1

print(n - abs(red - blue))

Solution (Python):


A = input()
N = len(A)

zero_num = A.count('0')
one_num = A.count('1')


if N == 1 or zero_num == 0 or one_num == 0:
    print(0)
    exit()

if zero_num == 1 or one_num == 1:
    print(2)
    exit()

if zero_num == one_num:
    ans = one_num*2
elif zero_num > one_num:
    ans = one_num*2
else:
    ans = zero_num*2

print(ans)

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

Solution (Python):
s=input()
ans=0
i=0
while i!=len(s) and len(s)>=2:
  if s[i:i+2]=="01" or s[i:i+2]=="10":
      s=s[:i]+s[i+2:]
      ans+=2
      i=max(0,i-1)
  else:
    i+=1
print(ans)

Solution (Python):

s = input()
n = len(s)

if n < 2:
    print(0)

else:
    ans, i = 0, 0
    rem = []

    while i < n:

        if not rem:

            if i+1 < n:
                if s[i] == s[i+1]:
                    rem.append(s[i])
                    i += 1

                else:
                    i += 2
                    ans += 2

            else:
                i += 1

        else:
            if rem[-1] != s[i]:
                rem.pop()
                i += 1
                ans += 2
            
            else:
                if i + 1 < n:
                    if s[i] == s[i+1]:
                        rem.append(s[i])
                        i += 1

                    else:
                        i += 2
                        ans += 2

                else:
                    i += 1
    print(ans)

Solution (Python):
S = input()
temp0 = S[:int(len(S)/2)]
temp1 = S[int(len(S)/2):]
temp01 = min(temp0.count('0'), temp1.count('1'))
temp10 = min(temp0.count('1'), temp1.count('0'))
print(temp01 * 2 + temp10 * 2)

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

Solution (Python):



S = list(input())
S = list(map(int,S))







zero = 0
for i in S:
    if i == 0:
        zero += 1
one = len(S) - zero
ans = one - zero if one > zero else zero - one
print(len(S) - ans)

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

Solution (Python):
S = input()

red = 0  
blue = 0 
m = 0
for s in S:
	if s == '0':
		if blue != 0:
			blue -= 1
			m += 2
		else:
			red += 1
	elif s == '1':
		if red != 0:
			red -= 1
			m += 2
		else:
			blue += 1

print(m)

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

ct1 = s.count('1')
ct0 = s.count('0')

print(int(min(ct1,ct0)*2))

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

Solution (Python):
s=[i for i in input()]
one=s.count("1")
zero=s.count("0")
print(len(s)-abs(one-zero))

Solution (Python):
class Solver:

    def __init__(self):
        pass


    def solve(self, s):
        one = 0
        zero = 0
        for ch in s:
            if ch == '1':
                one += 1
            else:
                zero += 1
        return len(s) - abs(one-zero)


if __name__ == '__main__':

    solver = Solver()
    s = input()
    n = solver.solve(s)
    print(n)

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

Solution (Python):
S=input()
N=len(S)
X=0
Y=0
for i in S:
    if i=="0":
        X+=1
    else:
        Y+=1
print(N-abs(X-Y))

Solution (Python):
S = list(input())
R = S.count('0')
B = S.count('1')

if(len(S) <= 1):
    print(0)
else:
    print(len(S) - abs(R-B))

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

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

Solution (Python):
a = list(map(int, list(input())))
sum = 0
for i in a:
  sum += i
b = len(a) - sum
if sum == 0:
  print("0")
elif b <= sum:
  print(b * 2)
else:
  print(sum * 2)

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

Solution (Python):
import collections


def main() -> None:
    S = list(input())
    a = collections.Counter(S)
    zero = a['0']
    one = a['1']
    if zero >= one:
        print(one * 2)
    else:
        print(zero * 2)


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin
l = list(stdin.readline().rstrip())
zero_count=l.count('0')
one_count=l.count('1')
if zero_count > one_count:
    print(one_count*2)
elif zero_count < one_count:
    print(zero_count*2)
elif zero_count == one_count:
    print(len(l))
elif len(l) == 1:
    print(0)

Solution (Python):
S = input()
s = [int(S[i:i + 1]) for i in range(len(S))]
ans = 0
v1 = s[0]
index = []
index.append(0)
for i in range(1, len(s)):
    if v1 != s[i] and len(index) != 0:
        ans += 2
        index.pop(-1)
        if len(index) != 0:
            v1 = s[index[-1]]
        else:
            v1 = 10
    else:
        index.append(i)
        v1 = s[i]
print(ans)

Solution (Python):


import random
import bisect




def IT(): 
    return int(input())
def IL(): 
    return [int(_) for _ in input().split()]
def IS(): 
    return [_ for _ in input().split()]
def ILS(n): 
    return [int(input()) for _ in range(n)]
def SLS(n): 
    return [input() for _ in range(n)]
def ILSS(n): 
    return [[int(_) for _ in input().split()] for j in range(n)]


def bit_full_search(ss):
    n = len(ss)
    for i in range(1 << n):
        s = ""
        for j in range(n + 1):
            if ((1 & i >> j) == 1):
                s += ss[j]
        print(s)
def bit_full_search2(A):
    
    value = []
    for i in range(1 << len(A)):
        output = []

        for j in range(len(A)):
            if ((i >> j) & 1) == 1:
                
                output.append(A[j])
        value.append([format(i, 'b').zfill(16), sum(output)])

    value.sort(key=lambda x:x[1])
    bin = [value[k][0] for k in range(len(value))]
    val = [value[k][1] for k in range(len(value))]
    return bin, val
def matching_bisect(list1_val, list2_val, n):
    
    j = 0
    for i in range(len(list1_val)):
        j = bisect.bisect_left(list2_val, n - list1_val[i])
        if j < len(list2_val):
            if list1_val[i] + list2_val[j] == n:
                
                break
    return j

"""ここからメインコード"""

def main():

    s = input()
    one = s.count("1")
    two = s.count("0")
    print(len(s) - abs(one-two))


main()

Solution (Python):
import sys
S = sys.stdin.readline().rstrip()
count = 0
stack = ''
for s in S:
    if len(stack) == 0 or s == stack[-1]:
        stack += s
        continue
    count += 2
    stack = stack[:-1]
print(count)