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):
if __name__ == '__main__':
    S = str(input())
    count1 = 0
    for s in S:
        if s =='1':
            count1 += 1
    count0 = len(S) - count1
    print(2*min(count0, count1))

Solution (Python):
d = []
s = input()
n = len(s)
ans = 0
for i in range(n):
    if len(d) > 0:
        if d[-1] != s[i]:
            d.pop()
            ans += 1
        else:
            d.append(s[i])
    else:
        d.append(s[i])

print(ans*2)

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

count = [0, 0]
for s in S:
    count[int(s)] += 1

res = min(count) * 2
print(res)

Solution (Python):
s = input()

red = 0
blue = 0
for i in range(len(s)):
    if s[i] == "0":
        red += 1
    else:
        blue += 1
        
result = min(red,blue)*2
print(result)

Solution (Python):
S = input()

red = 0
blue = 0
for i in range(len(S)):
    if S[i] == "0":
        red += 1
    else:
        blue += 1
        
ans = min(red,blue)*2
print(ans)

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

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

Solution (Python):
s = list(input())
a = []
c = 0
for i in s:
    if a == []:
        a.append(i)
    elif a[-1] != i:
        a.pop()
        c += 2
    else:a.append(i)
print(c)

Solution (Python):
S = input()

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

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

Solution (Python):
s=str(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):
temp = input()
s = [int(elm) for elm in temp]

oneNum = sum(s)
zeroNum = len(s) - oneNum
deleteNum = min(oneNum*2, zeroNum*2)

print(deleteNum)

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

Solution (Python):
S = input()
array = []
for i in range(len(S)):
    array.append(S[i])
print(len(S)-abs(array.count('0')-array.count('1')))

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

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

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

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

Solution (Python):
from collections import deque

s = input()
cnt = 0
i = 0
n = len(s)
stack = deque()
updated = True
while updated:
    updated = False
    while i < n and len(stack) > 0 and stack[-1] != s[i]:
        updated = True
        stack.pop()
        i += 1
        cnt += 2
    if i < n:
        updated = True
        stack.append(s[i])
    i += 1

print(cnt)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


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

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

Solution (Python):
def main():
  msg=list(input())
  a=msg.count("1")
  b=len(msg)-a
  print(2*min(a,b))
main()

Solution (Python):
def main():
  msg=list(input())
  a,b=0,0
  for _ in msg:
    if _ == "0":
      a+=1
    else:
      b+=1
  ans=2*min(a,b)
  print(ans)    
main()

Solution (Python):
def main():
  msg=list(input())
  import collections as col
  cnt=col.Counter(msg)
  blue,red=cnt["1"],cnt["0"]
  ans=2*(min(blue,red))
  print(ans)  
main()

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

Solution (Python):
s = input().strip()
a, b = 0, 0
for c in s:
    if c == '0':
        a += 1
    else:
        b += 1
print(a + b - abs(a - b))

Solution (Python):
s = sorted(input())
point = 0
for i in range(len(s)):
    if s[i] == '1':
        point = i
        break
print(len(s)-(max(point, len(s)-point)-min(point, len(s)-point)))

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

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

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

Solution (Python):
S = input()
one = S.count("1")
zero = S.count("0")

print(min(one, zero)*2)

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

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

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

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

Solution (Python):
s=input()

dd='0'
ee='1'
ze=0
on=0

for i in range(len(s)):
    if s[i]==dd:
        ze+=1
    else:
        on+=1
print(min(ze,on)*2)

Solution (Python):
s = input()
cnt1 = 0
cnt0 = 0
for i in s:
    if i == "0":
        cnt0 += 1
    else:
        cnt1 += 1
print(len(s)-abs(cnt1-cnt0))

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

def main():
    S = input().strip()
    print(min(S.count("1"), S.count("0"))*2)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = input()

s = list(s)

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

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

print(min(count0, count1)*2)

Solution (Python):
x=0
s=input()
for i in s:
    if i=="0":
        x+=1
    else:
        x-=1
print(len(s)-abs(x))

Solution (Python):
S=input()
LS=len(S)
l=[]
n=S[0]
cnt=0

for i,s in enumerate(S):
	if s!=n:
		l.append(cnt if n=='0' else -cnt)
		cnt=1
		n=s
	else:
		cnt+=1
	
	if i==LS-1:
		l.append(cnt if n=='0' else -cnt)

def func(l):
	if len(l)==1:
		return 0
	t=[]
	r=0
	for i in range(len(l)//2):
		a,b=l[2*i],l[2*i+1]
		if a*b<0:
			r+=2*min(abs(a), abs(b))
		t.append(a+b)
	if len(l)%2==1:
		t.append(l[-1])
	r+=func(t)
	return r

print(func(l))

Solution (Python):
S = input()

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

ans = min(count_0, count_1) * 2
print(ans)

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

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

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

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

total = 0

x = 0
y = 0
for i in range(len(S)):
    if S[i] == "0": x += 1
    if S[i] == "1": y += 1

m = min(x,y)

print(2 * m)

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

Solution (Python):
S = list(input())
one_count = 0
for s in S:
    if s == "1":
        one_count += 1
print(min(one_count, len(S) - one_count) * 2)

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

N=len(S)

N0=S.count("0")
N1=N-N0

print(min(N0,N1)*2)

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

Solution (Python):
S=input()

total=0
count=0
for i in range(len(S)):
    if(int(S[i])==1):
        p=1
    else:
        p=-1
    if(total*p<0):
        count+=1
    total+=p

print(count*2)

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

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

Solution (Python):
str = input()

count1 = str.count('1')
count0 = str.count('0')
print(2 * min(count1, count0))

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

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

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

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

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

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

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

S=input().split()
S=list(S[0])
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):
import sys
input = sys.stdin.readline

S=input().split()
S=list(S[0])
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=[]
cnt=0
for i in s:
  if not stack:
    stack.append(i)
  elif stack[-1]!=i:
    stack.pop()
    cnt+=2
  else:
    stack.append(i)
print(cnt)

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

Solution (Python):
s=list(input())
count=s.count("0")


print(min(count,len(s)-count)*2)

Solution (Python):
def unification(n,s):
    rc = 0
    bc = 0

    for c in s:
        if c == '0':
            rc += 1
        elif c == '1':
            bc += 1
        else:
            break

    return min(rc,bc) * 2

if __name__ == '__main__':
    s = raw_input()
    n = len(s)
    _s = [i for i in s]

    print unification(n,_s)

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

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

    
    
    
    
    
    
    
    
    
    
    
    
    

    



main()

Solution (Python):
S = input()
s = list(S)
size = len(S)
stack = []
for i in range(size):
    if len(stack) == 0 :
        stack.append(s[i])
    else :
        if stack[-1] != s[i] :
            stack.pop(-1)
        else :
            stack.append(s[i])

print("{}".format(size-len(stack)))

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = list(input())
stack = deque()
ans = 0
for i in range(len(s)):
    if len(stack) == 0:
        stack.append(s[i])
        continue
    if stack[-1] != s[i]:
        stack.pop()
        ans += 2
    else:
        stack.append(s[i])
print(ans)

Solution (Python):
s = input()
z = s.count('0')
if 2*z > len(s):
  print((len(s)-z)*2)
else:
  print(2*z)

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

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

Solution (Python):
import math
import copy
import fractions
import numpy as np
from functools import reduce



def getInputNum():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList



n, = map(str, input().split())
data = list(n)

cntOne = 0
cntZero = 0

for i in range(len(data)):
    if data[i] == "0":
        cntZero += 1
    else:
        cntOne += 1

ans = int(2*min(cntOne, cntZero))
print(ans)

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

Solution (Python):
s = input()
t = len([c for c in s if c == '0'])
print(2 * min(t, len(s) - t))

Solution (Python):
S = list(input())
count1 = 0
count0 = 0
if len(S) == 1:
    print(0)
    exit()
for i in range(len(S)):
    if S[i] == "1":
        count1 += 1
    else:
        count0 += 1
ans = 2*min(count1,count0)
print(ans)

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

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

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

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

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

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

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

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

Solution (Python):
def main():
    S = input()
    stack = []
    count = 0
    for i in range(len(S)):
        if not stack:
            stack.append(S[i])
        else:
            if stack[-1] != S[i]:
                stack.pop()
                count += 2
            else:
                stack.append(S[i])
    return count

if __name__ == '__main__':
    print(main())

Solution (Python):
import sys
import math
s = input()

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

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

Solution (Python):
s=input()
cnt=0
idx=0
while(1):
  if idx >=len(s):
    break
  if s[idx:idx+2] in ('01','10'):
    cnt+=1
    s=s[:idx]+s[idx+2:]
    idx = max(0,idx-1)
  else:
    idx+=1
print(cnt*2)

Solution (Python):
S = input()
sum = 0
for s in S:
    if s == "1":
        sum += 1
    else:
        sum -= 1
print(len(S) - abs(sum))

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

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

S=[]
s=input()
for c in s:
        S.append(c)
S.pop(-1)
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 = input()

m = [0]*2
for c in s:
    if c == '1':
        m[1] += 1
    else:
        m[0] += 1

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

Solution (Python):
s= input()

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

Solution (Python):
S = input()


N = len(S)

count_0 = 0
count_1 = 0

for i in range(N):
    if S[i] == '0':
        count_0 += 1
    else:
        count_1 += 1

if count_0 > count_1:
    print(int(count_1*2))

else:
    print(int(count_0*2))

Solution (Python):
import collections

s = input()
c = collections.Counter(s)
print(min(c['1'],c['0'])*2)

Solution (Python):
from collections import Counter
C = Counter(list(input()))
print(C["0"]*2 if C["0"]<=C["1"] else C["1"]*2)

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

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

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

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

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

Solution (Python):
S = input()
a = b = c = 0
for s in S:
    if s == "0":
        c += b > 0
        a += b == 0
        b = max(0, b-1)
    elif s == "1":
        c += a > 0
        b += a == 0
        a = max(0, a-1)
print(c*2)

Solution (Python):
S = input()

ze = 0
one = 0

for el in S:
    if el == '0':
        ze += 1
    else:
        one += 1


print(min(ze, one)*2)

Solution (Python):
from collections import Counter

s = input()
res = Counter(s)
print(min(res['0'], res['1']) * 2)

Solution (Python):

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

Solution (Python):
n=input()

count=0
stack=[]

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

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


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

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

Solution (Python):

import sys
import math
from collections import defaultdict


sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


mod = 10**9 + 7


def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))



S = input()
n = len(S)

ans = 0


left = []


i = 0


for i in range(n):
    if S[i]=='0':
        if left:
            if left[-1] == '1':
                ans += 1
                left.pop()
            else:
                left.append('0')
        else:
            left.append('0')
    else:
        if left:
            if left[-1] == '0':
                ans += 1
                left.pop()
            else:
                left.append('1')
        else:
            left.append('1')
    
print(2*ans)

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

Solution (Python):
s = input()

count1 = s.count('1')
count2 = s.count('0')

print((count1+count2) - abs(count1-count2))

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

Solution (Python):
S = input()

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

if c1 >= c2:
  ans =c2*2
else:
  ans=c1*2
  
print(ans)

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

Solution (Python):
s = list(input())
red = 0
blue = 0
for i in s:
    if i == '0':
        red += 1
    else:
        blue += 1
ans = min(red,blue)*2
print(ans)

Solution (Python):
S = str(input())
cube = list(S)
count0 = 0
count1 = 0

for string in cube:
    if string == '0':
        count0 = count0 + 1
    else:
        count1 = count1 + 1

print(min(count0,count1) * 2)

Solution (Python):
S = input()

if len(S) == 1:
    print(0)
else:
    if S.count("0")== S.count("1"):
        print(S.count("0")*2)
    else:
        print(len(S)-(max(S.count("0"),S.count("1")) - min(S.count("0"),S.count("1"))))

Solution (Python):
s=input()
l=len(s)
a=[0 for i in range(l)]

for i in range(l):
  a[i]=int(s[i])
  
ichi=0
zero=0

for i in range(l):
  if a[i]==1:
    ichi+=1
  else:
    zero+=1
    
print(2*min(ichi,zero))

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

ans = []
cnt = 0

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

Solution (Python):
from collections import defaultdict as dd


INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*args):
    return tuple(p(v) for p, v in zip(args, input().split()))


def main():
    S = input()
    c = [0, 0]
    for s in S:
        c[s == "1"] += 1
    print((len(S) - abs(c[0] - c[1])))

main()

Solution (Python):
S = input()

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

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

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

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

Solution (Python):
def solve():
    s = input()
    c0 = s.count("0")
    c1 = s.count("1")
    return 2 * min(c0, c1)


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

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

Solution (Python):
s = [int(x) for x in list(input())]
n = len(s)
c = sum(s)
print(min(c, n-c) * 2)

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

Solution (Python):
s = list(input())
count_zero = 0
count_one = 0
for i in range(len(s)):
    if s[i] == '1':
        count_one += 1
    else:
        count_zero += 1

print(len(s) - abs(count_zero - count_one))

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

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

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

Solution (Python):
S = input()
n = len(S)
r = S.count('0')
b = n - r
print(2 * min([r, b]))

Solution (Python):

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

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

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

Solution (Python):
s = input()

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

print(min(count_0,count_1) * 2)

Solution (Python):
s = input()
0

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

print(min(count_0,count_1) * 2)

Solution (Python):
s = list(map(int, list(input())))
i = [x for x in s if x == 1]
m = sum(i)
n = len(s)-m

if n <= m:
    print(n*2)
else:
    print(m*2)

Solution (Python):
s =str(input())
red=0
blue=0
for i in range(len(s)):
    if s[i]=="0":
        red+=1
    else:
        blue+=1
print(2*min(red, blue))

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

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

Solution (Python):
import itertools
import collections

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

s = input()

res = 0
stk = []
for c in s:
    if stk and stk[-1] != c:
        stk.pop()
        res += 2
    else:
        stk.append(c)

print(res)

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

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

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

    
resolve()

Solution (Python):
s = input()

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

Solution (Python):
S = input()

stackA=[]
stackB=[]
for s in S:
    if s == "0":
        stackA.append(s)
    else:
        stackB.append(s)
print(min(len(stackA),len(stackB))*2)

Solution (Python):
S = input().rstrip()

ans = 0
cnt0 = 0
cnt1 = 0
for s in S:
    if s == '0':
        if cnt1 > 0:
            ans += 2
            cnt1 -= 1
        else:
            cnt0 += 1
    else:
        if cnt0 > 0:
            ans += 2
            cnt0 -= 1
        else:
            cnt1 += 1
print(ans)

Solution (Python):
s = input()

redCount = s.count('0')
blueCount = s.count('1')

if redCount == blueCount:
    print(len(s))
elif redCount > blueCount:
    print(blueCount * 2)
else:
    print(redCount * 2)

Solution (Python):

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

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

Solution (Python):
s = input()
n = len(s)
zero_count = 0
counts = [0, 0]
for c in s:
    if c == '0':
        counts[0] += 1
    else:
        counts[1] += 1
print(min(counts[0], counts[1]) * 2)

Solution (Python):
e = []
ans = 0
S = list(input())
for k in S:
    e.append(k)
    if(len(e)>1):
        if(e[-1] != e[-2]):
            ans += 2
            e.pop()
            e.pop()
print(ans)

Solution (Python):

s = input()

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

print(2*min(blue, red))

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

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

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

Solution (Python):
N = input()
zeronum = N.count("0")
onenum = N.count("1")

ans = 2 * min(zeronum,onenum)
print(ans)

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

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

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

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

ans=[s[0]]
for i in range(1,len(s)):
    if len(ans) !=0 and ans[-1]!=s[i]:
        ans.pop(-1)
        continue
    
    else:
        ans.append(s[i])

print(len(s)-len(ans))

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

Solution (Python):
S = list(input())
stack = []

res = 0

for s in S:
    if stack and stack[-1] != s:
        stack.pop()
        res += 2
        continue
    stack.append(s)
print(res)

Solution (Python):
S = input()

s_len = len(S)
count_0 = 0
count_1 = 0

for i in range(s_len):
    if S[i] == "0":
        count_0 += 1
    else:
        count_1 += 1

ans = min(count_0, count_1) * 2

print(ans)

Solution (Python):
s = input()
s = list(s)
s = [int(x) for x in s]
a = s.count(1)
b = s.count(0)
print(len(s)-abs(a-b))

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

print(2*min(a,b))

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

Solution (Python):
S = input()




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

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

def main():
    s = input().strip()
    c0 = s.count("0")
    print(2 * min(c0, len(s) - c0))

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
l = len(S)
T = list(S)


tmp = 0

while tmp < len(T)-1:
    if T[tmp] != T[tmp+1]: 
        T.pop(tmp)
        T.pop(tmp)
        if tmp == 0:
            tmp = 0
        else:
            tmp -= 1
    else:
        tmp += 1


k = len(T)

ans = l - k

print(ans)

Solution (Python):
S=input()
s0=S.count("0")
s1=S.count("1")

print(2*min(s0,s1))

Solution (Python):
s=input()
i=0
n=len(s)
a=0
b=0
while(i<n):
	if(s[i]=='0'):
		a+=1
	else:
		b+=1

	i+=1

print(min(a,b)*2)

Solution (Python):
s = list(input())
cnt0 = s.count('0')
cnt1 = s.count('1')

print(min(cnt0,cnt1)*2)

Solution (Python):
S = input()
ct0 = 0
ct1 = 0
for s in S:
    if s == '0':
        ct0 += 1
    else:
        ct1 += 1
print(min(ct0, ct1)*2)

Solution (Python):
import collections

s = input().split()[0]

counter = collections.Counter(list(s))
c_0 = counter['0']
c_1 = counter['1']
step = min(c_0, c_1)
print(step * 2)

Solution (Python):
S = input()


count_1 = 0
count_0 = 0

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

if count_1 >= count_0:
  print(count_0*2)
else:
  print(count_1*2)

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

n1 = sum(s)
n0 = len(s) - n1

print(min(n0, n1)*2)

Solution (Python):
s = [_ for _ in input()]

def are_different(a, b):
    if (a == "0" and b == "1") or (a == "1" and b == "0"):
        return True
    else:
        return False

len_ori = len(s)
res = []
while len(s) > 0:
    
    
    while len(s) >= 2 and s[0] != s[1]:
            s.pop(0)
            s.pop(0)
    
    
    while len(s) >= 1 and len(res) >= 1 and res[-1] != s[0]:
        res.pop(-1)
        s.pop(0)
    if len(s) >= 1:
        res.append(s[0])
        s.pop(0)

    
    

print(len_ori - len(res))

Solution (Python):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


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

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()