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

import sys
input = sys.stdin.readline

s = input().rstrip()
n = len(s)
zero = s.count("0")
one = s.count("1")
print(n - max(zero, one) + min(zero, one))

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

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

Solution (Python):

s = input()

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

Solution (Python):
s = str(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):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
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 input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(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()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

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

Solution (Python):
S = input()
n = len(S)
red = S.count("0")
blue = n - red
print(n if red == blue else min(red, blue) * 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=list(input())
x=len(s)
from collections import deque
d=deque()

for i in s:
    if len(d)==0:
        d.append(i)
    elif d[-1]!=i:
        d.pop()
    elif d[-1]==i:
        d.append(i)

print(x-len(d))

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

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

Solution (Python):
s = str(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=S.count("1")
B=S.count("0")
print(min(A,B)*2)

Solution (Python):



S = list(input())


zero_num = 0
one_num = 0


for s in S:
    if s=='0':
        zero_num += 1
    else:
        one_num += 1


if not zero_num>0 or not one_num>0:
    print(0)
else:
    min_ans = min(zero_num, one_num)
    print(min_ans * 2)

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

Solution (Python):
s=str(input())
n=len(s)
b=s.count('0')
A=[b,n-b]
print(min(A)+min(A))

Solution (Python):
r = 0
b = 0
for a in input():
    if a == '0':
        r += 1
    else:
        b += 1

print(min(r, b)*2)

Solution (Python):
import sys

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

    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 = list(ns())
a = min(s.count('0'),s.count('1'))

print(a*2)

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

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

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






slen = len(S)
zero = 0
one = 0
for i in range(slen):
    if S[i] == '0':
        zero += 1
    else:
        one += 1
if (zero > one):
    print(one * 2)
else:
    print(zero * 2)

Solution (Python):
S = [int(i) for i in list(input())]
s = ["", ""]
c = 0
for v in S:
    s.append(v)
    
    if (s[-1], s[-2])==(0, 1) or (s[-1], s[-2])==(1, 0):
        s.pop()
        s.pop()
        c += 2

print(c)

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
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 input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(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()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

s = [int(i) * 2 - 1 for i in STR()]
ss = abs(sum(s))
l = len(s)
ans = (l - ss) // 2
print(ans * 2)

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

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

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

Solution (Python):
class Node:
    def __init__(self, num: str):
        self.num = num
        self.before = None
        self.next = None
    
class Linked_List:
    def __init__(self):
        self.head = None
        self.tail = None
    
    def append(self, node):
        if self.head is None:
            self.head = node
            self.tail = node
        else:
            node.before = self.tail
            self.tail.next = node
            self.tail = node

    def check(self):
        node = self.tail
        ans = 0
        while not node is self.head:
            before_node = node.before
            if node.num != before_node.num:
                ans += 2
                if before_node is self.head:
                    break
                elif node is self.tail:
                    before_node.before.next = None
                    self.tail = before_node.before
                    node = before_node.before
                else:
                    before_node.before.next = node.next
                    node.next.before = before_node.before
                    node = node.next
            else:
                node = node.before
        print(ans)

S = list(input())
cube = Linked_List()

for c in S:
    node = Node(c)
    cube.append(node)

cube.check()

Solution (Python):



s = input()


zero_count = 0
one_count = 0


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


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

Solution (Python):
L=input()

A=L.count("0")
B=L.count("1")
print(2*min(A,B))

Solution (Python):
import sys

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

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
print(2*min(map(input().count,"01")))

Solution (Python):

import collections
S = input()
S1 = [int(x) for x in list(str(S))]

c = collections.Counter(S1)

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

Solution (Python):


S=input()
ans=0
cnt=0
blo=-1
for s in S:
    if cnt==0:
        blo=s
        cnt+=1
        continue
    if blo==s:
        cnt+=1
    else:
        ans+=1
        cnt-=1
print(ans*2)

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

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

n = len(s)
c_0 = s.count("0")
c_1 = n - c_0

ans = min(c_0, c_1) * 2

print(ans)

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
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 input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(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()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

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

Solution (Python):

s = list(input())

tmp = []
ans = 0
for i in range(len(s)):
    if len(tmp) > 0 and tmp[-1] == '0' and s[i] == '1':
        tmp.pop()
        ans += 2
    elif len(tmp) > 0 and tmp[-1] == '1' and s[i] == '0':
        tmp.pop()
        ans += 2
    else:
        tmp.append(s[i])
print(ans)

Solution (Python):
s=input()
b=0
r=0
for ss in s:
    if ss=='1':
        b+=1
    elif ss=='0':
        r+=1
print(2*min(b,r))

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

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

Solution (Python):
S=input()
r=b=0
for s in S:
    if s == '0':
        if b > 0: b -= 1
        else: r += 1
    else:
        if r > 0: r -= 1
        else: b += 1
print(len(S)-r-b)

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


if __name__ == '__main__':
    main()

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

Solution (Python):








import sys
sys.setrecursionlimit(10 ** 5 + 10)


def resolve():
    S = input()
    S = [int(c) for c in S]

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

resolve()

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    s=readline().strip()
    
    res=0
    count0=0
    count1=0
    i=0
    l=len(s)
    while i<l:
        if i==l-1:
            if s[i]=="0":
                count0+=1
            else:
                count1+=1
            i+=1
        elif s[i]==s[i+1]:
            if s[i]=="0":
                count0+=1
            else:
                count1+=1
            i+=1
        else:
            res+=2
            i+=2

    print(res+min(count0,count1)*2)

if __name__=="__main__":
    main()

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

Solution (Python):
S = list(map(int,(input())))
c0 = S.count(0)
c1 = len(S)-c0
print(min(c0,c1)*2)

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

Solution (Python):
S=input()
N=len(S)
st=[]

for str in S:
  
  if len(st)==0:
    st.append(str)
  else:
    if str!=st[-1]:
      st.pop()
    else:
      st.append(str)
      
print(N-len(st))

Solution (Python):
s=input()

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

print(min(a,b)*2)

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

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

cnt0, cnt1 = 0, 0
for i in range(n):
    if s[i] == "0":
        cnt0 += 1
    else:
        cnt1 += 1

ans = min(cnt0, cnt1) * 2
print(ans)

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

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

a = list_n.count("0")
b = list_n.count("1")
ab = max(a, b) - min(a, b)

print(l-ab)

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

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

Solution (Python):

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

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

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

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

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

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

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

Solution (Python):
S=input()

red=0
blue=0

for i in range(len(S)):
    if S[i]=="0":
        red+=1
    else:
        blue+=1

print(min(red,blue)*2)

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

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

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

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

count = 0
stack = []


while(len(s) > 0):
    cube = s.pop()

    if len(stack) == 0 or stack[-1] == cube:
        stack.append(cube)
    else:    
        stack.pop()
        count += 2

print(count)

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

c0 = 0
c1 = 0
for i in range(len(s)):
    if s[i] == 0:
        c0 += 1
    if s[i] == 1:
        c1 += 1

print(2 * min(c0, c1))

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

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

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

Solution (Python):




def main():
    S = input()

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


if __name__ == "__main__":
    main()

Solution (Python):
from collections import Counter

S = list(input())

tmp = Counter(S)

cnt = tmp.most_common()
cnt.append(("null", 0))

print(cnt[1][1] * 2)

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

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

Solution (Python):

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

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

tmp = S.count("0")
print(min(tmp, len(S) - tmp) * 2)

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

Solution (Python):

from collections import deque


def submit():
    s = input().strip()
    q = deque()
    ans = 0

    for c in s:
        if len(q) == 0:
            q.append(c)
        else:
            top = q.pop()
            if top != c:
                ans += 2
            else:
                q.append(top)
                q.append(c)
            
    print(ans)


if __name__ == "__main__":
    submit()

Solution (Python):
s = input()
c = s.count('0')

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

Solution (Python):
s = list(input())
n = len(s)
i = 0
cnt = 0
while i < n - 1:
    if n == 1:
        break
    if (s[i] == '0' and s[i + 1] == '1') or (s[i] == '1' and s[i + 1] == '0'):
        s[i:i + 2] = []
        i = max(i - 1, 0)
        cnt += 2
        n = len(s)
    else:
        i += 1

print(cnt)

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

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

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

Solution (Python):

s = list(input())

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

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

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

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

last = S.pop(0)
stack = [last]
can_pop = True
cnt = 0
for s in S:
    if last != s and can_pop:
        stack.pop()
        if len(stack) == 0:
            can_pop = False
        
        cnt += 2
    else:
        stack.append(s)
        last = s
        can_pop = True

print(cnt)

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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 input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(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()))

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

s = STR()
n = len(s)
stack = deque()
for i in range(n):
    if not len(stack) or stack[len(stack)-1] == s[i]:
        stack.append(s[i])
    else:
        stack.pop()
print(n - len(stack))

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
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 input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(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()))

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

s = STR()
n = len(s)
stack = deque(s[0])
for i in range(1, n):
    if not len(stack) or stack[len(stack)-1] == s[i]:
        stack.append(s[i])
    else:
        stack.pop()
print(n - len(stack))

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


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

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()
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):
s = input()

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

print(2*min(one,zero))

Solution (Python):
S = input()

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

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

Solution (Python):
s = str(input())
s_0,s_1 = 0,0
for i in range(len(s)):
    if(s[i] == "0"):
        s_0 += 1
    else:
        s_1 += 1
c = len(s)-(max(s_0,s_1)-min(s_0,s_1))
print(c)

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

Solution (Python):
s=input()

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

print(2*min(red,blue))

Solution (Python):


s = input().rstrip()

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

print(ans)

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

cnt0 = S.count('0')
cnt1 = S.count('1')
ans = min(cnt0, cnt1) * 2
print(ans)

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

Solution (Python):
s = input()
li = []

for i in s:
    if i=="1":
        li.append(1)

ans = 2*min(len(li), len(s)-len(li))
print(ans)

Solution (Python):









import sys



ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

if __name__ == '__main__':
    main()

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

X = 0
Y = 0

for i in range(N):
    if S[i]=="0":
        X += 1
    else:
        Y += 1

print(min(X,Y)*2)

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

Solution (Python):
import numpy as np

s = np.array(list(map(int , input())))
n = np.count_nonzero(s == 0)
print(2 * min(len(s)-n, n))

Solution (Python):
a=[int(i) for i in input()]
st=[]
for i in a:
    flag=0
    while st and st[-1]!=i:
        st.pop()
        flag=1
        break
    if flag==0: st.append(i)
print(len(a)-len(st))

Solution (Python):


S = input().strip()


num_red = S.count("0")
num_blue = len(S) - num_red

print( min(num_red,num_blue) * 2 )

Solution (Python):
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=input()
n=len(s)
S=s.count("0")
print(n-abs(S-n+S))

Solution (Python):
s=list(input())
x=s.count('1')
y=s.count('0')
z=min(x,y)
print(z*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()













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

Solution (Python):
s = input()

stack = []

ans = 0

for s_i in s:
  if len(stack) == 0:
    stack.append(s_i)
    continue
  if (s_i == "0" and stack[-1] == "1") or (s_i == "1" and stack[-1] == "0"):
    stack.pop()
    ans += 2
  else:
    stack.append(s_i)
print(ans)

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

odd = 0
even = 0

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

print(2*min(odd, even))

Solution (Python):
s=input()
a=s.count("0")
b=len(s)-a
if a>=b:
  print(2*b)
else:
  print(2*a)

Solution (Python):

S = input()

dic = [0,0]

for i in S:

    dic[int(i)] += 1

print (min(dic)*2)

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

Solution (Python):
import numpy as np

S = str(input())

A = S.count('0')

B = S.count('1')

ans = len(S)-int(abs(A-B))

print(ans)

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

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

Solution (Python):
import collections
s = list(input())
s = [int(i) for i in s]

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

Solution (Python):
S = list(input())
n = len(S)
red = S.count("0")
blue = n - red
print(n if red == blue else n - abs(red - blue))

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

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

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

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

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

Solution (Python):
s = input()

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

print(min(c0, c1)*2)

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

print(min(count0,count1)*2)

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

count0 = s.count('0')
count1 = len(s) - count0

answer = min(count0,count1) * 2
print(answer)

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

Solution (Python):

S=input()
r=S.count('0')
b=S.count('1')
print(len(S)-abs(r-b))

Solution (Python):
S = input()
N = len(S)
ones = 0
zeros = 0
for s in S:
    if s == '0':
        zeros += 1
    else:
        ones += 1
ans = zeros - ones
if ans < 0:
    ans *= -1
print(N - ans)

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

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

Solution (Python):
st = []
S = input()
ans = 0
for c in S:
    if st != [] and c != st[-1]:
        st.pop(-1)
        ans += 2
    else:
        st.append(c)
print(ans)

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

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

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

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

Solution (Python):
S = input()
A = [int(c) for c in S]

l = len(S)
L = [[0 for j in range(l + 1)] for i in range(2)]
R = [[0 for j in range(l + 1)] for i in range(2)]

for i in range(l):
    L[0][i + 1] = L[0][i]
    L[1][i + 1] = L[1][i]
    L[A[i]][i + 1] += 1

for i in range(l - 1, -1, -1):
    R[0][i] = R[0][i + 1]
    R[1][i] = R[1][i + 1]
    R[A[i]][i] += 1

k = 0
for a, b, c, d in zip(L[0], R[1], L[1], R[0]):
    k = max(k, min(a, b) + min(c, d))

print(k * 2)

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

Solution (Python):
import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = readline().decode('utf8')
n1 = N.count('1')
n0 = N.count('0')
print(min(n1, n0)*2)

Solution (Python):
s=list(map(int,input()))
a=len(s)
b=0
c=0
for i in range(a):
  if s[i]==0:
    b+=1
  else:
    c+=1
d=min(b,c)*2
print(d)

Solution (Python):
import collections


class Solution:
    def solve(self, S: str) -> int:

        c = collections.Counter(S + "01")
        zeros = c["0"] - 1
        ones = c["1"] - 1

        return 2 * min(zeros, ones)


if __name__ == '__main__':

    
    S = input()

    
    solution = Solution()
    print(solution.solve(S))

Solution (Python):
s = input()

t = s[0]
for i in s[1:]:
  if not t:
    t=i
    continue
  if i != t[-1]:
    t=t[:-1]
  else:
    t+=i

print(len(s) - len(t))

Solution (Python):
s = list(input())
n = len(s)
cntd = {'0':0, '1':0}

for i in range(n):
    cntd[s[i]] += 1
ans = 0
ans = 2 * min(cntd.values())
print(ans)

Solution (Python):
s = input()

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

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

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

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

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

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

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

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

stack = []
stack.append(S[0])
S = S[1:]

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

print(N - len(stack))

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

res = 0 

stack = deque()

for cube in S:
    if (not stack) or cube == stack[0]:
        stack.appendleft(cube)
    else:
        stack.popleft()
        res += 2

print(res)

Solution (Python):
s = [int(x) for x in list(map(str, input()))]

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

print(min(x, y) * 2)

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

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

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

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

    zero = s.count('0')
    one = len(s) - zero

    print(min(zero, one) * 2)

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

s0 = 0
s1 = 0

for c in s:
    if c == '0':
        s0 += 1
    else:
        s1 += 1

print(min(s0, s1)*2)

Solution (Python):
s = list(input())
n = len(s)
sub = [0] * 2

for i in range(n):
    sub[int(s[i])] += 1
    
ans = min(sub[0],sub[1])*2
print(ans)