Problem:
 Score : 300 points    Problem Statement There are N cubes stacked vertically on a desk.  You are given a string S of length N . The color of the i -th cube from the bottom is red if the i -th character in S is 0 , and blue if that character is 1 .  You can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.  At most how many cubes can be removed?      Constraints  1 \leq N \leq 10^5  |S| = N  Each character in S is 0 or 1 .         Input Input is given from Standard Input in the following format:  S       Output Print the maximum number of cubes that can be removed.        Sample Input 1 0011      Sample Output 1 4  All four cubes can be removed, by performing the operation as follows:   Remove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.  Remove the first and second cubes from the bottom.        Sample Input 2 11011010001011      Sample Output 2 12       Sample Input 3 0      Sample Output 3 0

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

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

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

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

Solution (Python):
S = list(input())
S = [int(s) for s in S]



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

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

Solution (Python):

S = input()
N = len(S)


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

Solution (Python):
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

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

Solution (Python):
from collections import Counter

S = list(input())
C = Counter(S)

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

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count





S = S()

d = DD(int)
for s in S:
  d[s] += 1
print(min(d["0"],d["1"])*2)

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

Solution (Python):
s = input()
c0 = 0
c1 = 0
for si in s:
    if si == '0':
        c0 += 1
    else:
        c1 += 1


print(2*min(c0,c1))

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

Solution (Python):
from collections import Counter
s = input()
if len(set(s))<2:
    print(0);exit()
print(min(Counter(s).values())*2)

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
c0 = s.count('0')
c1 = s.count('1')
print(2*min(c0, c1))

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

Solution (Python):

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

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

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

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

if '0' in c and '1' in c:
	print(min(c['0'],c['1'])*2)
else:
  print(0)

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

Solution (Python):
import sys
def S(): return sys.stdin.readline().rstrip()
S = [int(s) for s in S()]
ans = 0
stack = []
for x in S:
    if stack and x^stack[-1]:
        stack.pop()
        ans += 2
    else:
        stack.append(x)
print(ans)

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

Solution (Python):
s = input()

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

print(2 * min(zero, one))

Solution (Python):

S = list(input())
cnt1 = len([i for i in range(len(S)) if S[i] == '1'])
cnt0 = len([i for i in range(len(S)) if S[i] == '0'])
print(min(cnt0,cnt1)*2)

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

count = Counter(s)
num0 = count['0']
num1 = count['1']

diff = num0 - num1
if (diff == 0):
    ans = num0 * 2
elif (diff > 0):
    ans = num1 * 2
else:
    ans = num0 * 2


print(ans)

Solution (Python):
import itertools
import math
import fractions
import functools
import copy
s = list(input())
one = s.count("1")
zero = s.count("0")

print(min(one,zero)*2)

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

Solution (Python):
import math
import copy
import re

s = input()
a = copy.copy(s)
s = re.sub("0","",s)
a = re.sub("1","",a)
print(min(len(a),len(s))*2)

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, 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()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


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

    S = iss()
    qu = []
    ret = 0

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


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

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

Solution (Python):
S = input()

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

print(min(zero, one)*2)

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

Solution (Python):
from collections import Counter

S = input()
c1 = Counter(S[0::2])
c2 = Counter(S[1::2])

print(len(S) - abs(c1['0'] - c2['1']) - abs(c1['1'] - c2['0']))

Solution (Python):
s = list(map(int,input()))
cnt0 = s.count(0)
cnt1 = s.count(1)

print(min(cnt0,cnt1)*2)

Solution (Python):
import collections

l=list(input())
c=collections.Counter(l)

if c['0']==c['1']:
    print(c['0']*2)
else:
    print(min(c['0'],c['1'])*2)

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

Solution (Python):


import sys






















def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    s = input()
    cnt_0 = s.count('0')
    cnt_1 = s.count('1')
    print(min(cnt_0, cnt_1) * 2)


if __name__ == "__main__":
    main()

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

Solution (Python):
s = str(input())
cnt = 0
prev = s[0]
stock = 1
for i in range(1, len(s)):
    if stock == 0:
        prev = s[i]
        stock += 1
    else:
        if s[i] != prev:
            cnt += 2
            stock -= 1
            if stock > 0:
                if s[i] == '0':
                    prev = '1'
                else:
                    prev = '0'
        else:
            prev = s[i]
            stock += 1
print(cnt)

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()
s_list = list(s)
c0 = 0
c1 = 0
for num in s_list:
  if num == '0':
    c0 += 1
  else:
    c1 += 1
print(min(c0,c1)*2)

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

Solution (Python):
import sys
from fractions import gcd
def input(): return sys.stdin.readline().strip()


def main():
    S = input()
    N = 0
    arr = []
    pre = S[0]
    num = 0
    for c in S:
        N += 1
        if c == pre:
            num += 1
        else:
            arr.append(num)
            num = 1
        pre = c
    arr.append(num)
    

    ans = 0
    for i in range(len(arr)):
        ans += arr[i] * (-1) ** i
    print(N - abs(ans))
    """
    i = 0
    while i < N:
        if arr[i] <= arr[i + 1]:
            arr[i + 1] -= arr[i]
            arr[i] = 0
            i += 1
        else:
            arr[i + 2] += arr[i] - arr[i + 1]
            arr[i] = 0
            arr[i + 1] = 0
            i += 2
    """

if __name__ == "__main__":
    main()

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


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

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

len_s = len(s)
s0 = s.count('0')
s1 = len_s - s0

print(len_s - abs(s0 - s1))

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

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

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

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

resolve()

Solution (Python):
s = input()
stk = []
ret = 0
for i in range(len(s)):
    if len(stk) == 0:
        stk.append(s[i])
    elif stk[-1] == '0':
        if s[i] == '1':
            stk.pop(-1)
            ret += 2
        else:
            stk.append('0')
    else:
        if s[i] == '0':
            stk.pop(-1)
            ret += 2
        else:
            stk.append('1')

print(ret)

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

Solution (Python):

import sys


def solve(S: str):
    print(min(S.count("0"), S.count("1")) * 2)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    solve(S)


if __name__ == '__main__':
    main()

Solution (Python):
S = input()

num0 = S.count("0")
num1 = S.count("1")

print(2*min(num0, num1))

Solution (Python):
s = input()
ones = 0
zeros = 0
for x in s:
  if x=="1":
    ones += 1
  else:
    zeros += 1
print(min(ones,zeros)*2)

Solution (Python):
def main():
  s = input()
  
  answer = 0
  
  print(2 * min(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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


s=input().rstrip()
n=len(s)
one,zero=0,0
for i in range(n):
    if int(s[i])==1:
        one+=1
    else:
        zero+=1
print(n-abs(one-zero))

Solution (Python):
s = input()

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

Solution (Python):
import sys


def solve():
    s = input()
    if len(s) == 1:
        print(0)
        sys.exit(0)
    zero = 0
    one = 0
    for i in range(len(s)):
        if s[i] == '0':
            zero += 1
        else:
            one += 1
    if zero > one:
        print(one*2)
    else:
        print(zero*2)


solve()

Solution (Python):
S=str(input())
l=len(S)
S_int=[0]*l
for i in range(l):
  S_int[i]=int(S[i])
print(min(S_int.count(0),S_int.count(1))*2)

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

Solution (Python):
def main():
    S = input()
    stack = list()
    cnt = 0
    for c in S:
        if len(stack) == 0:
            stack.append(c)
        else:
            if stack[-1] != c:
                stack.pop()
                cnt += 2
            else:
                stack.append(c)
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):
import itertools
import math
import fractions
import functools

string = input()
s = []
for i in range(len(string)):
    s.append(int(string[i]))
count = [0,0]
for i in range(len(s)):
    if s[i] == 0: count[0] += 1
    if s[i] == 1: count[1] += 1

print(min(count)*2)

Solution (Python):
s = input()

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

if red > blue:
    print(blue*2)
elif red < blue:
    print(red*2)
else:
    print(red+blue)

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

Solution (Python):
s = input()
l = len(s)
o = s.count("0")

print(min(o*2, (l - o)*2))

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

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

count_0 = 0
count_1 = 0

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

print(min(count_0, count_1)*2)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())

count_0 = 0
count_1 = 0

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

print(min(count_0, count_1)*2)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

S = list(input())

cnt0 = S.count("0")
cnt1 = S.count("1")

print(min(cnt0, cnt1) * 2)

Solution (Python):
import collections

s = list(input())

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

print(min(num_0,num_1)*2)

Solution (Python):
s=list(input())
count=0
kaisu=1
while kaisu>0:
  kaisu=0
  n=len(s)
  for i in range(0,n):
    i=n-i-1
    try:
      if s[i]!=s[i-1]:
        count+=1
        kaisu+=1
        s.pop(i)
        s.pop(i-1)
    except IndexError:
      pass

print(count*2)

Solution (Python):
s=input()
l=len(s)
o=s.count("0")
print(min(o*2,(l-o)*2))

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

Solution (Python):
s = input()
a = [0,0]
res = 0
for i in range(len(s)):
  if s[i] == '0':
    a[0] += 1
  elif s[i] == '1':
    a[1] += 1
  if a[0] >= 1 and a[1] >= 1:
    res += 2
    a[0] -= 1
    a[1] -= 1
print(res)

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

Solution (Python):


s = input()

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

ans = min(c0, c1)*2
print(ans)

Solution (Python):

S = input()
N = len(S)

zeros = 0
for s in S:
    if s == '0':
        zeros += 1
res = min(zeros, N-zeros) * 2

print(res)

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

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

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

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

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

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()
z = 0
o = 0
for c in s:
    if c=='0':
        z += 1
    else:
        o += 1
print(z+o-abs(z-o))

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

Solution (Python):
s = input()
zero = s.count('0')
one = s.count('1')
if zero <= one:
    print(2 * zero)
else:
    print(2 * one)

Solution (Python):
import collections

s = list(input())

count = collections.Counter(s)

zero = count['0']
one = count['1']

print(2 * min(zero,one))

Solution (Python):
from collections import Counter

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

Solution (Python):
s=input()

blue_count=s.count("1")
red_count=s.count("0")

print(2*min(blue_count, red_count))

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

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

Solution (Python):

"""
Created on Sat May  2 21:55:08 2020

@author: matha
"""







s = list(input())

c = 0


i = 1
while i < len(s):
    if (s[i] != s[i-1]):
        s.pop(i-1)
        s.pop(i-1)
        c += 2
        if (i>2):
            i = i-2
        if i ==2:
            i = i-1
    else:
        i+=1
    

print(c)

Solution (Python):
s = input()
count_0 = s.count('0')
count_1 = s.count('1')
len_s = len(s)
print("{}".format(len_s-abs(count_0 - count_1)))

Solution (Python):
from collections import Counter
S = input()
l = list()
for i in S:
    l.append(i)
c = Counter(l)
print(min(c['0'], c['1'])*2)

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

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

Solution (Python):

s=input()

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

print(2*min(c0,c1))

Solution (Python):
s=[c for c  in input()]
print(min(s.count('0'),s.count('1'))*2)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]

from collections import defaultdict 



S = input()

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

Solution (Python):


S = str(input())

zeroCnt = S.count('0')
oneCnt = S.count('1')

print(min(zeroCnt, oneCnt)*2)

Solution (Python):


S = str(input())

zeroCnt = 0
oneCnt = 0
ans = 0
for i in range(len(S)):
    if S[i]=='0':
        if oneCnt==0:
            zeroCnt += 1
        else:
            ans += 2
            oneCnt -= 1
    else:
        if zeroCnt==0:
            oneCnt += 1
        else:
            ans += 2
            zeroCnt -= 1

print(ans)

Solution (Python):

def solve():

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


if __name__ == "__main__":
    solve()

Solution (Python):
S= input()

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

Solution (Python):
s = input()
c = 0
for i in range(len(s)):
    if s[i] == '0':
        c += 1
if c > len(s)/2:
    ans = (len(s) -c) * 2
else:
    ans = c * 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
print(len(s)-(max(zero,one)-min(zero,one)))

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

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

Solution (Python):
from sys import stdin
from collections import Counter


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    S =     _in[0]   
    
    S_count = Counter(S)
    cnt = len(S) - abs(S_count['0']-S_count['1'])
    
    print(cnt)

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

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

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

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

Solution (Python):
s = input()

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

Solution (Python):
S = input()
cube = ["?"]

ans = 0

for s in S:
    if cube[-1] == "?":
        cube.append(s)
    elif s != cube[-1]:
        ans += 2
        cube.pop()
    else:
        cube.append(s)

print(ans)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
S=input()
N=len(S)
prezero=0
preone=0
for i in range(N):
    s=S[i]
    if s=="0":
        if preone>0:
            preone-=1
        else:
            prezero+=1
    if s=="1":
        if prezero>0:
            prezero-=1
        else:
            preone+=1
print(N-prezero-preone)

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

Solution (Python):
S=input()
from collections import Counter
C=Counter(S)
print(len(S)-abs(C['0']-C['1']))

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 heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
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 = list(input())
c = Counter(S)

ans = INF

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

Solution (Python):
import sys

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

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
S = input().strip()
C = {"0":0,"1":0}
for i in range(len(S)):
    C[S[i]] += 1
print(min(C["0"],C["1"])*2)

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

pair = 0
stack = [-1]
for s in S:
    tmp = int(s)
    if 1 - tmp == stack[-1]:
        pair += 1
        stack.pop()
    else:
        stack.append(tmp)

ans = 2 * pair
print (ans)

Solution (Python):
if __name__ == "__main__":
    s = input()
    ans = 0
    red = 0
    blue = 0
    for ss in reversed(s):
        if ss == '0':
            red += 1
            if blue > 0:
                red -= 1
                blue -= 1
                ans += 2
        else:
            blue += 1
            if red > 0:
                red -= 1
                blue -= 1
                ans += 2

    print(ans)

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

if __name__ == "__main__":
  resolve()

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

    ans = 0
    st = []
    for x in s:
        st.append(x)
        if len(st) >= 2:
            if st[-1] != st[-2]:
                st.pop()
                st.pop()
                ans += 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):


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    s=input()
    z=s.count("0")
    o=s.count("1")
    print(min(z,o)*2)

main()

Solution (Python):
S = input()

n_0 = S.count('0')
n_1 = S.count('1')

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

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

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

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):
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 defaultdict
def unification(s):

    ans = 0
    d = defaultdict(int)
    for k in s:
       d[k] += 1

    ans = len(s) - abs(d["0"]-d["1"])

    return ans

def main():
    s = str(input())
    print(unification(s))

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
n=input()
a=n.count('1')
b=n.count('0')
if a<b:
    print(2*a)
else:
    print(2*b)

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

Solution (Python):

s = input()
cnt1 = 0
cnt2 = 0
for i in s:
    if i == "0":
        cnt1 += 1
    else:
        cnt2 += 1
print(2*min(cnt1,cnt2))

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