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):
from collections import Counter

c = Counter(input())

print(2*min(c['1'], c['0']))

Solution (Python):
s = input()
count0 = s.count('0')
count1 = len(s)-count0
if min(count0,count1)==0:
  print(0)
else:
  print(min(count0,count1)*2)

Solution (Python):
def myAnswer(S:list) -> int:
   zero = 0
   one = 0
   for s in S:
      if(s == "0"):
         zero += 1
      else:
         one += 1
   return min(zero,one)*2

def modelAnswer(S:list) -> int:
   return

def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()

Solution (Python):

s = input()
n = len(s)
n_0 = s.count("0")
n_1 = s.count("1")
d = abs(n_0 - n_1)
print(n - d)

Solution (Python):

import sys
input = sys.stdin.readline









S = input().rstrip()

r = S.count("0")
b = S.count("1")

print(min(r,b)*2)

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

Solution (Python):
s = input()

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

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

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

Solution (Python):
class DoubleLinkedList:
    def __init__(self, v):
        self.value = v
        self.prev = None
        self.next = None


s = input().rstrip()

root = DoubleLinkedList(None)
current = root

count = 0
for i in range(len(s)):
    node = DoubleLinkedList(s[i])

    if (current.value == '0' and node.value == '1') or (current.value == '1' and node.value == '0'):
        current = current.prev
        count += 2
    else:
        current.next = node
        node.prev = current
        current = node

print(count)

Solution (Python):


from collections import deque,Counter













S = input()

cnt = Counter(S)
low = min(cnt["0"],cnt["1"])
ans = low*2

print(ans)

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

Solution (Python):


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

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

Solution (Python):
S = input()
S = [Si for Si in S]

i = len(S) - 2
number_of_deleted_qube = 0
while i >= 0 and len(S) >= 2:
    if i >= len(S) - 1:
        i -= 1
        continue

    current = S[i]
    right = S[i + 1]

    if current != right:
        del S[i + 1]
        del S[i]
        number_of_deleted_qube += 2

    i -= 1

print(number_of_deleted_qube)

Solution (Python):

"""
a, b, c = map(int, input().split())
print(min(b//a, c))
"""

"""
a, b, k = map(int, input().split())
for i in range(max(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
             print(i)
"""



s = list(input())
an0 = 0
an1 = 0
for i in s:
    if i == "1":
        an1 += 1
    if i == "0":
        an0 += 1
print(min(an0, an1)*2)
"""



n, m = map(int, input().split())
ab = []
for i in range(m):
    ab.append(list(map(int, input().split())))

ab = ab[-1::-1]
size = [1 for _ in range(n)]
height = [1 for _ in range(n)]
par = [i for i in range(n)]
def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def union(x, y):
    s1 = find(x)
    s2 = find(y)
    if s1 != s2:
        if height[s1] < height[s2]:
            par[s1] = s2
            size[s2] += size[s1]
            size[s1] = 0
        else:
            par[s2] = s1
            size[s1] += size[s2]
            size[s2] = 0
            if height[s1] == height[s2]:
                height[s1] += 1
 

ans = [0 for i in range(m)]
ans[0] = n * (n - 1) // 2
for num, i in enumerate(ab):
    if num == m-1:
        break
    a = i[0] - 1
    b = i[1] - 1
    sizea = size[find(a)]
    sizeb = size[find(b)]
    if find(a) == find(b):
        ans[num + 1] = ans[num]
    else:
        ans[num + 1] = ans[num] - (sizea * sizeb)
    union(a,b)
    
    
ans = ans[-1::-1]
for i in ans:
    print(i)
"""

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

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

Solution (Python):
from collections import Counter
s = list(input())

x = [0, 0]
for si in s:
    x[int(si)] += 1

print(2*min(x))

Solution (Python):
def myAnswer(S:list) -> int:
   C0 = 0
   C1 = 0
   for s in S:
      if(s =="0"):
         C0+=1
      else:
         C1 += 1
   return 2*min(C0,C1)

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()

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

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

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

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
red = S.count('0')
blue = S.count('1')
answer = 2 * min(red, blue)
print(answer)

Solution (Python):
import collections

S = input()
c = collections.Counter(S)
if len(c)==2:
    print(2 * min(c.values()))
else:
    print(0)

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

Solution (Python):
s=input()

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

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

Solution (Python):
def resolve():
    s = list(input())
    rcount = 0
    bcount = 0
    for i in s:
        if i == "0":
            rcount += 1
        else:
            bcount += 1
    print(min(rcount, bcount) * 2)
resolve()

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

Solution (Python):
S = list(input())
c0 = 0
c1 = 0
for i in S:
    if i == '0':
        c0 += 1
    else:
        c1 += 1
ans = min(c0,c1) * 2
print(ans)

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

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

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

Solution (Python):
s = list(input())
before = []
cnt = 0
for i,now in enumerate(s):
    if i == 0 or len(before) == 0:
        before.append(now)

        continue
    if before[-1] != now:
        before.pop()
        cnt += 2
    else:
        before.append(now)

print(cnt)

Solution (Python):
a = input()
c_zero = 0
c_one = 0
for digit in a:
    if digit == '0':
        c_zero += 1
    else:
        c_one += 1
print(min(c_one, c_zero) * 2)

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

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

Solution (Python):
s=input()
c0=0
c1=0

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

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()
n = len(s)

def main():
    c = s.count('0')
    print(min(n-c, c) * 2)

if __name__ ==  '__main__':
    main()

Solution (Python):
from collections import deque
s=input()
d=deque()
for i in range(len(s)):
  if len(d)>0:
    if d[len(d)-1]!=s[i]:
      d.pop()
    else:
      d.append(s[i])
  else:
    d.append(s[i])
print(len(s)-len(d))

Solution (Python):
s = input()
l0, l1 = 0, 0
for i in s:
    if i == '0':
        l0 += 1
    else:
        l1 += 1
        
print(len(s)-abs(l0-l1))

Solution (Python):










mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    zero = s.count('0')
    one = s.count('1')
    print(min(zero*2,one*2))
if __name__ == '__main__':
  main()

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

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

Solution (Python):
num = input()
predicted_value = 0
finished = False
i = 1
while i < len(num):
    if num[i] != num[i-1]:
        num = num[:i-1] + num[i+1:]
        predicted_value += 2
        if i > 1:
            i -= 2
        elif i == 1:
            i = 0
    i += 1
print(predicted_value)

Solution (Python):
s = input()

ones = 0
zeros = 0
for c in s:
    if c == '1':
        ones += 1
    else:
        zeros += 1

remove = 2 * min(ones, zeros)
print(remove)

Solution (Python):
s = input()

a = 0
tmp = 0
for i in s:
    if i == '1':
        a += 2
    else:
        tmp += 2
        
print(min(a, tmp))

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

a = [0, 0]
for s in sl:
    a[int(s)] += 1

print(min(a) * 2)

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

Solution (Python):
from collections import Counter
d={chr(i):0 for i in range(2)}
s=Counter(input())
d=d.update(s)
print(min(s["0"],s["1"])*2)

Solution (Python):
from collections import deque
s=deque(input())
N=len(s)
A=[]
for i in range(N):
  a=s.popleft()
  if len(A)!=0:
    if A[-1]!=a:
      A.pop()
    else:
      A.append(a)
  else:
    A.append(a)
print(N-len(A))

Solution (Python):
def main():
    s = input()
    mi = min(s.count(c) for c in '01')
    ans = mi * 2
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    from collections import Counter

    s = input()

    ctr = Counter(s)
    ctr.update({'0': 0, '1': 0})

    ans = min(ctr.values()) * 2

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

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

print(2*min(a,b))

Solution (Python):
s = input()

total = len(s)
cnt_one = 0
cnt_zero = 0

for i in s:
    if i == '1':
        cnt_one += 1
    else:
        cnt_zero += 1

print(min(cnt_zero, cnt_one) * 2)

Solution (Python):
from collections import deque
N = list(input())
S = [int(i) for i in N]
cnt = 0
que = deque(([-1,S[0]]))

for i in range(1,len(S)):
    jdg = que.pop()

    if (S[i] + jdg) == 1:
        cnt += 2
    else:
        que.append(jdg)
        que.append(S[i])
        
print(cnt)

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

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

Solution (Python):
d = dict()
d['0'] = 0
d['1'] = 0

S = input()

for x in S:
    d[x] += 1
print(min(d['0'], d['1'])*2)

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

Solution (Python):
from collections import Counter
s = input()
ans = dict(Counter(s))
if '0' in ans and '1' in ans:
    print(min(ans['0'],ans['1'])*2)
else:
    print(0)

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

o_count = S.count('0')
i_count = S.count('1')

print(min(o_count,i_count)*2)

Solution (Python):

s = input()

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

Solution (Python):
s=input()
c0,c1=0,0
for ss in s:
  if ss=="0":
    c0+=1
  else:
    c1+=1
print(2*min(c0,c1))

Solution (Python):
def resolve():
  S = input()
  arr = []
  for s in S:
    if len(arr) != 0 and arr[-1] != s:
      arr.pop()
    else:
      arr.append(s)

  print(len(S) - len(arr))
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
s = input()
cnt = 0
n = len(s)
for x in s:
    if x == '0':
        cnt+=1
ans = min(cnt,n-cnt)*2
print(ans)

Solution (Python):
from collections import Counter
S = list(input())
S = list(map(int, S))

cnt = Counter(S)
setS = set(S)
if len(setS) == 1:
    print(0)
else:
    print(2*min(cnt[0], cnt[1]))

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

Solution (Python):
S = list(input())
a, b = 0, 0
for s in S:
    if s == '1':
        a += 1
    if s == '0':
        b += 1
print(min(a, b)*2)

Solution (Python):
S=input()

count_1=0
count_0=0

for s in S:
    if s=="0":
        count_0+=1
    else:
        count_1+=1

print(min(count_0,count_1)*2)

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

count1=N.count('1')
count0=N.count('0')

print(min(count1, count0)*2)

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

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


if __name__ == '__main__':
    main()

Solution (Python):
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]
dij = [(1, 0), (-1, 0), (0, 1), (0, -1)]


def main():
    s=SI()
    cnt0=s.count("0")
    cnt1=len(s)-cnt0
    print(min(cnt0,cnt1)*2)

main()

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

s = STR()
t = Counter(s)
print(min(t['0'], t['1']) * 2)

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

    cnt1 = sum(S)
    cnt0 = len(S) - cnt1
    print(2 * min(cnt0, cnt1))


if __name__ == "__main__":
    main()

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

Solution (Python):
S = list(input())
N = len(S)
T = []
while True:
    for i in S:
        if not T or T[-1] == i:
            T.append(i)
        else:
            T.pop()
    if S == T:
        break
    S = T[:]
    T.clear()
print(N - len(S))

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    cunt1=0
    cunt2=0
    for ss in s:
        if ss=='1':cunt1+=1
        else:cunt2+=1
    print(min(cunt1,cunt2)*2)

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    cunt1=0
    cunt2=0
    for ss in s:
        if ss=='1':cunt1+=1
        else:cunt2+=1
    print(min(cunt1,cunt2)*2)

if __name__=='__main__':
    main()

Solution (Python):
s = input()
z = s.count("0")
o = s.count("1")

print(min(z, o)*2)

Solution (Python):
S = input()

S = [s for s in S]
cnt = {'0': 0, '1': 0}
for s in S:
    cnt[s] += 1

print(min(cnt.values()) * 2)

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

Solution (Python):
S = input()
ary1 = [int(x) for x in S]
ary2 =[]

for x in ary1:
  if ary2 == []:
    ary2.append(x)
  elif ary2[-1] == x:
    ary2.append(x)
  else :
    ary2.pop()

print(len(S)-len(ary2))

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

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

l = []
tmp = []
i = 0
ans = 0
while i < n-1:
	if s[i] != s[i+1]:
		ans += 1
		num = 2
		while i+num < n:
			if len(l) == 0:
				break
			left = l.pop()
			right = s[i+num]
			if s[left] != right:
				ans += 1
				num += 1
			else:
				l.append(left)
				break
		i += num
	else:
		l.append(i)
		i += 1

print(2*ans)

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

Solution (Python):
S = input()

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

Solution (Python):
from collections import deque
 
s=input()
sd=deque(s)
d=deque()
while(len(sd)>0):
  crr = sd.popleft()
  if(len(d)<1):
    d.append(crr)
    continue
  if(len(d)>=1 and d[-1]!=crr):
    d.pop()
  else:
    d.append(crr)
print(len(s)-len(d))

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

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

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

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

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

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

Solution (Python):
stack = []
s = input()
ans = 0
for c in s:
    if stack:
        tmp = stack.pop()
        if c == tmp:
            stack.append(tmp)
            stack.append(c)
        else:
            ans+=2
    else:
        stack.append(c)
print(ans)

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

Solution (Python):
from collections import Counter
S = input()
C = Counter(S).values()
if len(C) == 2:
    print(min(2*c for c in C))
else:
    print(0)

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

Solution (Python):
from collections import Counter

s = list(input())
c = Counter(s)
print(min(c["0"], c["1"]) * 2)

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

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from collections import deque

def main():
    s = IS()
    dq = deque()
    dq.append(s[0])
    cnt = 0
    for i in range(1, len(s)):
        if len(dq) == 0: dq.append(s[i]); continue
        a = dq[-1]
        b = s[i]
        if a == b: dq.append(b)
        else: dq.pop(); cnt += 2
    print(cnt)

if __name__ == '__main__':
    main()

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

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

print(min(red, blue) * 2)

Solution (Python):
S = input()

O = S.count("0")
I = S.count("1")

diff = abs(O-I)

print(len(S)-diff)

Solution (Python):
s = input()


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

print(len(s)-abs(score))

Solution (Python):
s = list(input())
n = len(s)
count = 0

for i in range(n):
  if s[i] == "1":
    count = count + 1
    
ans = min((n-count),count)*2
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(-1)
        count += 2
    else:
        stack.append(s)

print(count)

Solution (Python):

s = list(input())
ZERO = s.count("0")

ONE = s.count("1")

print(2*min(ZERO,ONE))

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
from collections import deque

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

S = i_s()
d = deque()

for s in S:
    if not d:
        d.append(s)
        continue
    tmp = d.popleft()
    if tmp == s:
        d.append(tmp)
        d.append(s)

print(len(S)-len(d))

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

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

x = s.count("0")
y = s.count("1")

print(min(x,y)*2)

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

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

Solution (Python):
S = input().strip()
x = sum(c == '0' for c in S)
y = len(S) - x
print(2 * min(x, y))

Solution (Python):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect




from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  s = input()
  if len(set(s)) == 1:
    print(0)
    sys.exit()
  a = Counter(s)
  ans = min(a.values()) * 2
  print(ans)
  
if __name__ == '__main__':
  main()

Solution (Python):
s = input()

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

print(min(red, blue) * 2)

Solution (Python):
S = input()



















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

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

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
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 = input()
t = s.count('1')
u = s.count('0')
print(min(t,u)*2)

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

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

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

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

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

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

Solution (Python):
s=input()

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

Solution (Python):
def inpl():
    return list(map(int, input().split()))
 
 
S = input()
print(min(S.count('0'), S.count('1')) * 2)

Solution (Python):
import collections
s_list = list(input())
s_counter = collections.Counter(s_list)
print(2 * min(s_counter["0"], s_counter["1"]))

Solution (Python):
S = input()

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

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

Solution (Python):
n_list = list(input())
n_len_o = len(n_list)
a = 0
while(1):
  flag = "ng"
  n_len = len(n_list)
  for i in range(a,n_len-1):
    if n_list[i] != n_list[i+1]:
      n_list.pop(i)
      n_list.pop(i)
      if i != 0:
        a = i - 1
      else:
        a = 0
      flag = "ok"
      break
  if flag == "ng":
    break
print(n_len_o-len(n_list))

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

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

n = min(blue,red)

print(n * 2)

Solution (Python):
s = input()
n = len(s)
blue = s.count('1')
red = n - blue
print(2 * min(blue, red))

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

Solution (Python):
from collections import Counter
s = input()
l = len(s)
c = s.count("0")
print(2*min(c,l-c))

Solution (Python):
s=sorted(list(input()))
if s[0]==s[-1]:
  print(0)
else:
  a=s.index('1')
  print(2*min(a,len(s)-a))

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(iss())
    z = S.count('0')
    i = S.count('1')
    print(min(z, i) * 2)


if __name__ == '__main__':
    main()

Solution (Python):
s=input()

n=len(s)
z1=s.count("0")
z2=n-z1

print(n-abs(z1-z2))

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

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

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

Solution (Python):
s = list(input())
a = s.count('0')
b = s.count('1')
print(len(s) - (max(a,b)-min(a,b)))

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

Solution (Python):
S = input()
x = len(S)
i = S.count('0')
k = x-i 
if i >= k:
    print(k*2)
else:
    print(i*2)

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

Solution (Python):
def main():
    s = input()

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

    print(min(c0, c1)*2)

if __name__ == "__main__":
    main()

Solution (Python):
s = input()

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

print(min(c0, c1)*2)

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

Solution (Python):
from collections import Counter
S = str(input())
SC = Counter(S)
v,c = zip(*SC.most_common())
if len(c) == 2:
  print(len(S) - abs(c[1]-c[0]))
else:
  print(0)

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

Solution (Python):
s=input()
ss=[]
for i in s:
    if len(ss)==0:
        ss.append(i)
    else:
        if i!=ss[-1]:
            ss.pop()
        else:
            ss.append(i)
print(len(s)-len(ss))

Solution (Python):
S = list(input())
for _ in range(len(S)):
    S[_] = int(S[_])

print(min(sum(S), len(S) - sum(S)) * 2)

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

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

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

Solution (Python):
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

S = input()
stack = []
for c in S:
    stack.append(c)
    while len(stack) >= 2 and stack[-1] != stack[-2]:
        del stack[-2:]
print(len(S) - len(stack))

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

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

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

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

Solution (Python):
s = input()

stack = []

ans = 0

for i in s:
	if not stack:
		stack.append(i)
	elif stack[-1] != i:
		stack.pop()
		ans += 2
	else:
		stack.append(i)

print(ans)

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    z, o = 0, 0
    for i in range(len(S)):
        if S[i] == "0": z += 1
        else: o += 1
    print(2 * min(z, o))
    return 0

if __name__ == "__main__":
    solve()

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

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

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

Solution (Python):
S = list(input())
now = 0
ans = 0
while now < len(S) - 1:
    if S[now] != S[now + 1]:
        for _ in range(2):
            S.pop(now)
        now = max(0, now - 1)
        ans += 2
    else:
        now += 1
print(ans)

Solution (Python):
S = input()

zero = 0
one = 0
ret = 0
for s in S:
    if s == "0":
        if one > 0:
            ret += 2
            one -= 1
        else:
            zero += 1
    elif s == "1":
        if zero > 0:
            ret += 2
            zero -= 1
        else:
            one += 1

print(ret)

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

Solution (Python):

GBN_DEBUG = False
GBN_DEBUG = True
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)



S = input()






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

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

Solution (Python):



S = list(input())


zero_count = 0
one_count = 0


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


if zero_count==0 or one_count==0:
    print(0)
elif zero_count>=one_count:
    print(one_count * 2)
else:
    print(zero_count * 2)

Solution (Python):
S = input()
red = S.count("0")
blue = S.count("1")
print(red + blue if red == blue else min(red, blue) * 2)

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