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()

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

remove = 2*min(cnt, len(s)-cnt)
print(remove)

Solution (Python):
S = input()

now = S[0]
c = 1
ans = 0

for s in S[1:]:
  if now == '':
    now = s
    c = 1
  else:
    if s == now:
      c += 1
    else:
      ans += 2
      c -= 1
      if c == 0:
        now = ''

print(ans)

Solution (Python):
s = input()

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

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

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

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()
stack=[2]
n=len(s)

cnt=0
for i in range(n):
  if s[i]=='0' and stack[-1]=='1':
    stack.pop()
    cnt+=2
  elif s[i]=='1' and stack[-1]=='0':
    stack.pop()
    cnt+=2
  else:
    stack.append(s[i])
print(cnt)

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

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

print(min(cnt_0,cnt_1)*2)

Solution (Python):
def main():
    S=input()
    s=0
    for i in range(0,len(S)):
        s=s+int(S[i])
    t=len(S)-s
    print(2*min(s,t))

if __name__ == '__main__':
    main()

Solution (Python):
s=input()
a_1=sum(i=="1" for i in s)
a_0=len(s)-a_1
print(min(a_0,a_1)*2)

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

Solution (Python):
N = input()

a = N.count("0")
b = N.count("1")

if a == 0 or b == 0:
    ans = 0
else:
    ans = min(a, b) * 2
print(ans)

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

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

if a == 0 or b == 0:
    ans = 0
elif a > b:
    ans = (a+b)-(a-b)
else:
    ans = (a+b)-(b-a)

print(ans)

Solution (Python):


a = [int(i) for i in list(input())]
print(min(a.count(0), a.count(1))*2)

Solution (Python):
a = [int(i) for i in list(input())]
print(min(a.count(0), a.count(1))*2)

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

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

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

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

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

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

    n0 = s.count("0")
    n1 = s.count("1")

    if n0 == n1:
        print(n0*2)
    elif n0 > n1:
        print(n1 * 2)
    else:
        print(n0 * 2)



calculate()

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

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

Solution (Python):
S = input()

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

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

Solution (Python):
a=input()
one=0
zero=0
for i in a:
  if i=="0":
    zero+=1
  else:
    one+=1

print(2*min(zero,one))

Solution (Python):
s = input()
n = len(s)
num_0 = s.count("0")
num_1 = n - num_0

print(n - abs(num_0 - num_1))

Solution (Python):
s=input()
nall=len(s)
nzero=s.count("0")
none=nall-nzero
if nall==0:
    print(0)
elif none<=nzero:
    print(none*2)
else:
    print(nzero*2)

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

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

Solution (Python):
S = input()
N_0 = S.count('0')
N_1 = S.count('1')

answer = 2 * min(N_0, N_1)
print(answer)

Solution (Python):
s = input()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
from collections import Counter

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()
    c = Counter(S)
    print(min(c['0'], c['1']) * 2)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
s = input()

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

print(min(red, blue) * 2)

Solution (Python):
s=input()
ans=int(0)
n=len(s)
b=int(0)
w=int(0)
for i in range(n):
    if s[i]=='0':
        b+=1
    else:
        w+=1

if b<w:
    print(2*b)
else:
    print(2*w)

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())
n0 = S.count('0')
n1 = S.count('1')
print(2*min(n0, n1))

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

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

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

Solution (Python):
class Stack(object):
    def __init__(self):
        self.container = []
    
    def __len__(self):
        return len(self.container)
    
    def push(self, elem):
        self.container.append(elem)
    
    def pop(self):
        idx = len(self.container) -1
        if idx < 0:
            return None
        ret = self.container[idx]
        del self.container[-1]
        return ret
    
    def compare(self, val):
        return self.container[-1] == val

if __name__ == '__main__':
    string = [int(i) for i in input()]
    ret = 0
    stack = Stack()
    stack.push(string[0])
    for s in string[1:]:
        if stack.__len__() == 0:
            stack.push(s)
            continue
        if stack.compare(s):
            stack.push(s)
        else:
            ret += 2
            stack.pop()

    print(ret)

Solution (Python):

import sys
import math
import os
import itertools
import _collections
import string

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)

def main():
    S = cin.string()
    print(min(S.count("0"),S.count("1")) * 2)
    return

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
List = list(S)
Length = len(List)
Sum = 0
for item in List:
  Sum += int(item)
Answer = Length - abs(2*Sum - Length)
print(Answer)

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

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

Solution (Python):
s = input()
cnt = 0
for i in range(len(s)):
    cnt += int(s[i])

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

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


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

print(2*m)

Solution (Python):
S = str(input())
s0 = s1 = 0
for s in S:
  if s == "1":
    s1 += 1
  else:
    s0 += 1
print(min(s0, s1)*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()
red = s.count("0")  
blue = s.count("1")  
print(2*min(red, blue))

Solution (Python):
s = input()

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

Solution (Python):
def main():
    A = input()
    print(2*min(A.count("0"),A.count("1")))
    
if __name__ == "__main__":
    main()

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

Solution (Python):
import re

s = input()

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

print(min(c0, c1)*2)

"""TLE
def trans_word(text):
    replacements = {'01': '', '10': ''}
    return re.sub('({})'.format('|'.join(map(re.escape, replacements.keys()))), lambda m: replacements[m.group()], text)

ans = 0
flag = True

while flag:
    s_tmp = s
    s = trans_word(s)
    ans += (len(s_tmp) - len(s))
    flag = len(s_tmp) - len(s)

print(ans)
"""

Solution (Python):
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

t = ns()
n = len(t)
s = [t[i] for i in range(n)]

a, b = 0, 0

for i in range(n):
    if s[i] == '0':
        a += 1
    elif s[i] == '1':
        b += 1

print(2 * min(a, b))

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

Solution (Python):
S = input()
zero = 0
one = 0

for s in S:
    if s == '0':
        zero += 1
    else:
        one += 1

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

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


if __name__ == '__main__':
    main()

Solution (Python):

import math
import heapq
import bisect
import numpy as np


S = input()

red = 0
ble = 0

for s in S:
    if s == '0':
        red += 1
    else:
        ble += 1

ans = min(red, ble)*2
print(ans)

Solution (Python):
S = input()

ones = 0
zeros = 0

for c in S:
    n = int(c)
    if n:
        ones += 1
    else:
        zeros += 1

print(min(ones, zeros) * 2)

Solution (Python):
S=input()

num0=0
num1=0

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

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

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

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

Solution (Python):
import sys
 
def main():
    S  = list(map(int, input()))
    o = S.count(0)
    l = S.count(1)
 
    print(min(o, l) * 2)
 
main()

Solution (Python):
import sys

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

def main():
    return min(s.count('0'), s.count('1')) * 2

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

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

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

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

Solution (Python):
from queue import LifoQueue

S = str(input())

q = LifoQueue()

ans = 0
for s in S:
    if not q.empty():
        before = q.get()
        if before != s:
            ans += 1
        else:
            q.put(before)
            q.put(s)
    else:
        q.put(s)

print(ans*2)

Solution (Python):
S = input()

count1 = 0
count0 = 0

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

print(min(count0, count1) * 2)

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

Solution (Python):
s=input()
n=len(s)
if len(set(s))==1:
    print(0)
else:
    c=s.count('1')
    print(min(c,n-c)*2)

Solution (Python):
import sys

def main():
    S  = list(map(int, input()))
    o = S.count(0)
    l = S.count(1)

    print(min(o, l) * 2)

main()

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

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

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

print(len(s)-(max(zero,one)-min(zero,one)))

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

Solution (Python):

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

Solution (Python):
s = input().strip()
red_cnt = s.count("0")
blue_cnt = len(s) - red_cnt
if (red_cnt <= blue_cnt):
    print(2 * red_cnt)
else:
    print(2 * blue_cnt)

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input():
    return sys.stdin.readline().rstrip()

def main():
    S=map(int,list(input()))
    c=[0,0]
    for s in S:
        c[s]+=1
    print(min(c)*2)

if __name__ == '__main__':
    main()

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

Solution (Python):
s=input()

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

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

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


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


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
l=[]
for ak in range(len(s)):
    l.append(s[ak])
no=[]
s=l
no.append(s[0])
br=0
for i in range(1,len(s)):
    no.append(s[i])
   
    if len(no) >= 2 and no[-1]!=no[-2]:
        no.pop(-1)
        no.pop(-1)
        br+=2
print(br)

Solution (Python):
s = input()
list_0 = 0
list_1 = 0
half = 0

for i in range(len(s)):
  if s[i] == "1" and list_0 == 0:
    list_1 += 1
  elif s[i] == "1" and list_0 != 0:
    list_0 =list_0 - 1
    half += 1
  elif s[i] =="0" and list_1 == 0:
    list_0 += 1
  else:
    list_1 = list_1 - 1
    half += 1

print(half * 2)

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

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

Solution (Python):


mojiretsu = input().rstrip()

stk = []
ans = 0

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


print(ans)

Solution (Python):
S = input()
n = len(S)
r = S.count("0")
b = S.count("1")

print(n - abs(r - b))

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

Solution (Python):
from collections import deque
S=input()

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

Solution (Python):
S=input()

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

Solution (Python):
import numpy as np

s = list(map(int, input().strip()))
s = np.array(s, dtype=np.bool)
len_s = len(s)

p = 0
count = 0

while p < len_s - 1:
    if s[p] != s[p + 1]:
        count += 2
        if p < len_s - 2:
            s[p:-2] = s[p + 2:]
        if p > 0:
            p -= 1
        else:
            p = 0

        len_s -= 2
    else:
        p += 1

print(count)

Solution (Python):
colors = input()
n_cube = len(colors)
n_1 = colors.count("1")
n_0 = n_cube - n_1
ans = 2 * min(n_0, n_1)
print(ans)

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

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

for i in range(n):
    if len(stack) > 0:
        if stack[-1] != s[i]:
            stack.pop()
        else:
            stack.append(s[i])
    else:
        stack.append(s[i])

print(n - len(stack))

Solution (Python):
s  = input()

cntr = 0
cntb = 0

for i in range(len(s)):
	if s[i] == '0':
		cntr += 1
	elif s[i] == '1':
		cntb += 1

print(2 * min(cntr, cntb))

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

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

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

Solution (Python):
from collections import Counter
s=input()
if len(set(s)) == 1:
  print(0)
else:
  cs=Counter(s)
  print(min(cs['0'],cs['1'])*2)

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

Solution (Python):
s = input()
r = 0
b = 0
for i in s:
    if i == "1":r += 1
    else: b += 1

now = max(b,r) - min(b,r)
ans = len(s)-now
print(ans)

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

Solution (Python):
S = input()

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

print(min(r, b)*2)

Solution (Python):

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

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

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):
S = str(input())
S= list(S)
switch = 0  
for i in range(len(S)):
    S[i] = int(S[i])
count_0 = 0
count_1 = 0
for i in range(len(S)):
    if S[i] == 0:
        count_0 = count_0 + 1
    else:
        count_1 = count_1 + 1
        
if count_0 > count_1:
    count = count_1
else:
    count = count_0
    
result = 2 * count
print(result)

Solution (Python):
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]

import sys
input = sys.stdin.readline
S = list(input())[:-1]
S = list(map(int, S))
N = len(S)
count_0 = counter(S, 0)
count_1 = N-count_0
print(N-abs(count_1-count_0))

Solution (Python):
S = input()

m = S.count('1')
n = S.count('0')

print(min(n,m)*2)

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

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

print(min(red,blue)*2)

Solution (Python):
qube = input()

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

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

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

Solution (Python):
from collections import Counter
n=str(input())
l=list(n)
c=Counter(l)
a=c["0"]
b=c["1"]
m=min(a,b)
print(2*m)

Solution (Python):
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7




S = sys.stdin.buffer.readline().decode().rstrip()

S = list(S)

S = np.array(S, dtype='U1')

ans = len(S) - abs((S == '0').sum() - (S == '1').sum())
print(ans)

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

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

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

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

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

print(ans)

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

total = len(s)

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

print(total - abs(zero-one))

Solution (Python):
def solve():
    S = input()

    zeros = S.count('0')
    ones = S.count('1')
    ans = min(zeros, ones) * 2
    print(ans)


if __name__ == '__main__':
    solve()

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

Solution (Python):
A=[j for j in input()]

ans=[A.count("0"),A.count("1")]
print(min(ans)*2)

Solution (Python):
A=[j for j in input()]

ans=[A.count("0"),A.count("1")]
print(min(ans)*2)

Solution (Python):
s = input()
cnt_zero = 0
cnt_one = 0
for letter in s:
    if letter == "0":
        cnt_zero += 1
    else:
        cnt_one += 1
res = min(cnt_zero, cnt_one) * 2
print(res)

Solution (Python):
S = input()
zero = S.count('0')
one = len(S) - zero

print(2*min(zero,one))

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

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

Solution (Python):

S = input()

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

print(len(S) - (max(zero, one) - min(zero, one)))

Solution (Python):


def solve_short(S: str):
    print(2*min(S.count('0'), S.count('1')))

def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print(N - len(stack))


def main():
    S = str(input())
    solve_short(S)

if __name__ == '__main__':
    main()

Solution (Python):


def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print(N - len(stack))


def main():
    S = str(input())
    solve(S)

if __name__ == '__main__':
    main()

Solution (Python):

import sys


def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print(N - len(stack))


def main():
    S = str(input())
    solve(S)

if __name__ == '__main__':
    main()

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

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

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

C0 = A.count("0")
C1 = A.count("1")

print(2 * min(C0, C1))

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

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

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     

def reverse_str(n):
    n = int(n)
    return str((1 - n) ** 2)

def main():
    s = S()
    dp = [(0, '') for _ in range(len(s)+1)]
    dp[0] = (1, s[0])
    for i in range(1, len(s)):
        prev_let = dp[i-1][1]
        prev_len = dp[i-1][0]
        if s[i] == prev_let:
            dp[i] = (prev_len + 1, s[i])
        elif prev_let == '':
            dp[i] = (prev_len + 1, s[i])
        else:
            if prev_len - 1 == 0:
                prev_let = ''
            else:
                prev_let = reverse_str(s[i])
            dp[i] = (prev_len - 1, prev_let)
    print(len(s) - dp[len(s)-1][0])

main()

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

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

Solution (Python):
S = input()

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

print(ans)

Solution (Python):
s=input()
ans=[]
for i in s:
    if ans==[]:
        ans.append(i)
    elif ans[-1]!=i:
        ans.pop()
    else:
        ans.append(i)
print(len(s)-len(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):
from queue import *

q = LifoQueue()
S=input()
count=0
for s in S:
    if q.empty():
        q.put(s)
    else:
        q_1 = q.get()
        if q_1 != s:
            count+=2
        else:
            q.put(q_1)
            q.put(s)
print(count)

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

Solution (Python):
s=input()

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

print(len(s)-abs(a-b))

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

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

Solution (Python):
def main():
    S = input()
    cnt = S.count("0")
    print(2 * min(cnt, len(S) - cnt))
    return


main()

Solution (Python):
l = []
ans = 0

for s in input():
    if s == "0":
        if l and l[-1] == "1":
            l.pop()
            ans += 2
        else:
            l.append(s)
    else:
        if l and l[-1] == "0":
            l.pop()
            ans += 2
        else:
            l.append(s)

print(ans)

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

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

S = list(input())
N = len(S)
S = np.array(S)
onecount = np.count_nonzero(S == "1")
print(2 * min(onecount, N - onecount))

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

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

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

Solution (Python):
s = input()
cnt = 0
idx = 1
tmp = ''
hit = True
while(hit):
	hit = False
	for i in range(idx, len(s)):
		if s[i-1:i+1] == '01' or s[i-1:i+1] == '10':
			tmp = s[0:i-1] + s[i+1: ]
			cnt += 2
			idx = i - 1 if i > 1 else 1
			hit = True
			s = tmp
			break
            
print (cnt)

Solution (Python):
import os, sys, re, math

S = input()

s1 = S.replace('1', '')
s2 = S.replace('0', '')

print (min(len(s1), len(s2)) * 2)

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

Solution (Python):
S = input()
reds = len([s for s in S if s == '0'])
blues = len([s for s in S if s == '1'])
ret = min(blues, reds) * 2
print(ret)

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

Solution (Python):
import collections

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

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

Solution (Python):
s = list(input())
cnt0 = 0
for i in s:
    if i == "0":
        cnt0 += 1

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

Solution (Python):
s = list(input())
cnt0 = 0
for i in s:
    if i == "0":
        cnt0 += 1
print(cnt0*2) if cnt0 <= len(s)//2 else print((len(s)-cnt0) * 2)

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

Solution (Python):

a = input()
len_a = len(a)
sum_a = sum(list(map(int,list(a))))
ret = min(sum_a,len_a-sum_a) * 2
print(ret)

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

Solution (Python):
s=input()
cnt=0
for c in s:
  cnt+=(int(c)-0.5)*2
print(len(s)-abs(int(cnt)))

Solution (Python):
def solve(s):
    zero = s.count('0')
    one = s.count('1')
    return len(s) - abs(zero-one)


if __name__ == '__main__':
    s = input()
    print(solve(s))

Solution (Python):
s = list(str(input()))
n = len(s)
red = s.count("0")
blue = n - red
print(n - abs(red - blue))

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

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

print(min(zero, one)*2)

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

Solution (Python):
s = input()
bef = ''
count = 0
lis = []
tmp = 0
for x in s:
  if x == bef or bef =='':
    tmp += 1
  else:
    lis.append(tmp)
    tmp = 1
  bef = x
lis.append(tmp)
  
print(min(sum(lis[0:][::2]), sum(lis[1:][::2])) * 2)