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

N=input()
 
A=N.count("1")
B=N.count("0")
if A==0 or B==0:
  print(0)
  exit()
 
print(min(A,B)*2)

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

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

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

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

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

Solution (Python):

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

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

Solution (Python):
s=input();
l=len(s)
zero,one=0,0
for i in s:
	if i=='0': zero+=1
	else: one+=1
print(min(zero, one)*2)

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

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

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

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

Solution (Python):
import sys
import itertools
from collections import deque
from operator import itemgetter

input = sys.stdin.readline
S = input()
counter = 0

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

Solution (Python):

N=input()

A=N.count("1")
B=N.count("0")
if A==0 or B==0:
  print(0)
  exit()

print(min(A,B)*2)

Solution (Python):
s = input()

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

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

Solution (Python):
import numpy as np

s=np.array(list(map(int,list(input()))))
k = s*2-1
print(len(k)-abs(sum(k)))

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

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

Solution (Python):

S = input()


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


print(ans)

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

Solution (Python):
S = input() 

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

Solution (Python):
S = input()
import re
if len(S) > 1:
    print(min(len(re.findall('0', S)), len(re.findall('1', S))) * 2)
else:
    print(0)

Solution (Python):
S = input()
cnt_1 = S.count('1')
cnt_0 = S.count('0')

print(min(cnt_1 , cnt_0) * 2)

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

print(min(a,b)*2)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



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


def main():
    S = input()
    N = len(S)

    stack = deque([])
    for c in S:
        if len(stack) == 0:
            stack.append(c)
            continue

        a = stack.pop()
        if a == c:
            stack.append(a)
            stack.append(c)

    print(N - len(stack))


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
cc = [c for c in S]
nbZero = 0
nbOne = 0
for c in cc:
    if c == "0":
        nbZero = nbZero + 1
    else:
        nbOne = nbOne + 1
d = min(nbZero, nbOne)
print(2*d)

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

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

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

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

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

Solution (Python):
inpString = [ i for x in input() for i in x ]
n0 = inpString.count('0')
n1 = inpString.count('1')
print( 2*min(n0,n1))

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

Solution (Python):
s = 0
p = 0
for c in input():
  n = int(c) * 2 - 1
  p += max(abs(s) - abs(s+n), 0) * 2
  s += n
print(p)

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

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

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

Solution (Python):
data = input()

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

print(min(x,y) * 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()

num0 = 0
num1 = 0
for i in S:
    if i == '0':
        num0 += 1
    else:
        num1 += 1

ans = min(num0,num1)*2
print(ans)

Solution (Python):
s = input()
n0, n1 = 0, 0

for c in s:
  if c == '0':
    n0 += 1
  else:
    n1 += 1
      
print(min(n0, n1)*2)

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

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

Solution (Python):
s = input()

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

Solution (Python):
S = input()
One = S.count("1")
Zero = S.count("0")
print(len(S) - max(One, Zero) + min(One, Zero))

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

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

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

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

Solution (Python):


import sys
import copy

sys.setrecursionlimit(1000000)







S = input().rstrip()

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

print(min(r, b) * 2)

Solution (Python):


import sys
import copy

sys.setrecursionlimit(1000000)






S = input().rstrip()

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

print(min(r, b) * 2)

Solution (Python):
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

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

print(min(a, b) * 2)

Solution (Python):
S = input()
SS = []
for s in range(len(S)):
  SS.append(int(S[s]))
zero = SS.count(0)
one = SS.count(1)
print(min(zero, one)*2)

Solution (Python):
bin_str = str(input())  
bitdigits = len(bin_str)  

cntzero = bin_str.count("0")
cntone = bin_str.count("1")

if cntzero < cntone:
    print(cntzero * 2)
else:
    print(cntone * 2)

Solution (Python):
def main():
    s = list(map(int,input()))
    print(min(len(s)-sum(s),sum(s))*2)
if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys


def solve(S: str):
    N  = len(S)
    RN = S.count('0')
    BN = N - RN
    print(min(RN,BN)*2)

    return



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 = str(input())
S_list = []

red = 0
blue = 0

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

print(2*min(red,blue))

Solution (Python):
def ans(S):
  zero = 0
  one  = 0
  for i in range(len(S)):
    if S[i] == "0":
      zero += 1
    else:
      one += 1
  return len(S) - abs(zero - one)

S = input()
print(ans(S))

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

zero = s.count('0')
one = len(s) - zero
ans = min(zero, one) * 2

print(ans)

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

zero = S.count('0')
if zero == N or zero == 0:
    print(0)
    exit()

one = N - zero
if zero == one:
    ans = N
elif zero > one:
    ans = one * 2
else:
    ans = zero * 2

print(ans)

Solution (Python):
S = input()

cnt_0 = 0
cnt_1 = 0

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

min_num = min(cnt_0, cnt_1)

if len(S) > 1:
    print(min_num * 2)
else:
    print(0)

Solution (Python):
S=input()
n=len(S)
i=0
cnt0=0
cnt1=0
while i<n:
       if S[i]=="1":
              cnt1+=1
       else:
              cnt0+=1
       i+=1
ans=min(cnt0,cnt1)
print(ans*2)

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

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

Solution (Python):
S = input()

l = []
for s in S:
	si = int(s)
	if not l:
		l.append(si)
	else:
		if (l[-1] + si) & 1:
			l.pop()
		else:
			l.append(si)
print(len(S) - len(l))

Solution (Python):
S = input()

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

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

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

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

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

Solution (Python):
def solve(S):
    zeros = 0
    ones = 0
    for i in range(len(S)):
        if S[i] == "0":
            zeros += 1
        elif S[i] == "1":
            ones += 1
    return len(S) - abs(zeros - ones)


S = input()
print(solve(S))

Solution (Python):
L = [int(i) for i in list(input())]
N = len(L)

one = L.count(1)
zero = L.count(0)

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

Solution (Python):
S = list(input())
cnt0 = S.count('0')
cnt1 = len(S)-cnt0
print(min(cnt0,cnt1)*2)

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

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

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

Solution (Python):
s = input()
n = len(s)
cnt = 0
for i in range(0, n):
  if s[i] == '0':
    cnt += 1

print(min(cnt, n-cnt) * 2)

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

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

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

Solution (Python):
from _collections import deque

s = input()
stack = deque()
for i in range(len(s)):
    stack.append(s[i])
    while len(stack) > 1:
        x = stack.pop()
        y = stack.pop()
        if x == y:
            stack.append(x)
            stack.append(y)
            break
print(len(s) - len(stack))

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

Solution (Python):

s = input()


n = len(s)
blue = s.count("1")
red = n - blue

print(min(blue,red)*2)

Solution (Python):
S = input()

ones = S.count("1")
zeros = S.count("0")

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

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

Solution (Python):
S=list(input())
red_cnt=0
blue_cnt=0
for s in S:
    if s=="0":
        red_cnt+=1
    elif  s=="1":
        blue_cnt+=1
print(min(red_cnt,blue_cnt)*2)

Solution (Python):
s = input().strip()
s = s[::-1]
ans = len(s)
i = 0
while (i + 1) < len(s):
    if s[i] != s[i + 1]:
        s = s[:i] + s[i + 2:]
        i = max(i - 1, 0)
    else:
        i += 1
print(ans - len(s))

Solution (Python):


S = input()
N = len(S)

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

ans = N - abs(cnt_0 - cnt_1)
print(ans)

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

Solution (Python):
S = input()
li = [0,0]
for it in S:
  li[int(it)]+=1
a,b = li
print ( min(a,b) * 2 )

Solution (Python):
S = input()

print(len(S) - abs(S.count('0') - S.count('1')))

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

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

ans = min(count, N - count) * 2
print(ans)

Solution (Python):



S = input()

red = 0
blue = 0

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

print(min(red,blue) * 2)

Solution (Python):
S = input()

count_red = S.count('0')

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

Solution (Python):
S = raw_input();

S1 = S.count('1');
S0 = S.count('0');

if S1 > S0:
	print S0 * 2;

else:
	print S1 * 2;

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


if __name__ == "__main__":
  main()

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

print(ans)

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

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

Solution (Python):
s = input()
total = 0

count_0 = s.count('0') * 2
count_1 = s.count('1') * 2

if count_0 < count_1:
  print(count_0)
else:
  print(count_1)

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

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

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

Solution (Python):
S = input()


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

print(min(zero, one)*2)

Solution (Python):
if __name__ == '__main__':
    S = str(input())
    N = len(S)
 
    count_0 = S.count('0')
    count_1 = S.count('1')
 
    answer = 2 * min(count_0, count_1)
 
    print(answer)

Solution (Python):
if __name__ == '__main__':
    S = str(input())
    N = len(S)

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

    answer = 2 * min(count_0, count_1)

    print(answer)

Solution (Python):
S = [int(c) for c in input()]
zeros = S.count(0)
ones = S.count(1)
print(2 * min(zeros, ones))

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

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

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

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

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

Solution (Python):
S = input()
ans = 0
i = 0
while i < len(S):
    if any(['01' in S[i:i+2],'10' in S[i:i+2]]):
        S = S[:i]+S[i+2:]
        ans += 2
        i -= 1
    else:
        i += 1
print(ans)

Solution (Python):
S = input()
sum_0 = 0
sum_1 = 0
for i in S:
  if (i == '0'):
    sum_0 += 1
  else:
    sum_1 += 1
print(2 * min(sum_0, sum_1))

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

Solution (Python):
S = input()
ones = S.count('1')
zeros = len(S) - ones
res = min(ones, zeros) * 2
print(res)

Solution (Python):

import sys
import collections


def solve(S: str):
    count_dict = collections.defaultdict(int)
    for s in S:
        count_dict[s] += 1
    print(min(count_dict['0'],count_dict['1'])*2)
    return



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


if __name__ == '__main__':
    main()

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

Solution (Python):
S, cnt = (str(input()), 0)
for c in S:
    cnt = cnt+1 if c=="1" else cnt-1
print(len(S)-abs(cnt))

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

cnt0=sum(s=='0' for s in S)
if len(S)/2>cnt0:
    print(cnt0*2)
else:
    print((len(S)-cnt0)*2)

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

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

Solution (Python):
S = input()
redcount = 0
bluecount = 0
for i in S:
    if i == "1":
        redcount += 1
    else:
        bluecount += 1

print(len(S)-abs(bluecount-redcount))

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

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

s = list(input())
l = {
    "0": 0,
    "1": 0,
}

for v in s:
    if l.get(v):
        l[v] += 1
    else:
        l[v] = 1
        
print(min(l["0"], l["1"]) * 2)

Solution (Python):
N = input()

num0 = 0
num1 = 0
for i in N:
    if i == '0':
        num0 = num0 + 1
    else:
        num1 = num1 + 1

print(2*min(num0,num1))

Solution (Python):
N = input()

A = []
for i in N:
    A.append(i)

cnt = 0
j = 0
while len(A) >= 2 and len(A)-1 > j:
    if A[j] != A[j+1]:
        cnt = cnt + 2    
        del A[j]
        del A[j]
        if j != 0:
            j -= 1
    else:
        j += 1

print(cnt)

Solution (Python):
import numpy as np

S = str(input())

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

ans = 2*min(cnt_0, cnt_1)
print(ans)

Solution (Python):


s = input()
n = len(s)

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

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

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

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

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



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

print (2 * min(blue, red))

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

Solution (Python):
S = input()

Z = len([i for i in S if i == "0"])
print(min([Z, len(S)-Z])*2)

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

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

Solution (Python):
s = input()

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

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

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

zero_cnt = C.count(0)
one_cnt = C.count(1)
print(min(zero_cnt,one_cnt) *2)

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

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

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


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

print(min(count_0, count_1) * 2)

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

Solution (Python):


def solve():
    S = input()

    num0 = 0
    num1 = 0
    for moji in S:
        if moji == "0":
            num0 += 1
        else:
            num1 += 1
    erase_num = min(num0, num1)
    print(erase_num*2)


if __name__ == "__main__":
    solve()

Solution (Python):
S = input()
f, t = 0, 0
for i in S:
    if i == '0':
        f += 1
    else:
        t += 1

print(2*min(f, t))

Solution (Python):
s = str(input())
z = sum([str(x)=='0' for x in s])
o = sum([str(x)=='1' for x in s])
print(2*min(z, o))

Solution (Python):

import sys
try:
    from math import gcd
except Exception:
    from fractions import gcd

from collections import Counter


def solve(S: str):
    c = Counter(S)
    c.setdefault('1', 0)
    c.setdefault('0', 0)
    return 2 * min(c.values())


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

if __name__ == '__main__':
    main()

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



def main():
    S = input()
    RED = "0"
    BLUE = "1"
    red_count = 0
    blue_count = 0
    ans = 0

    for si in S:
        if si == RED:
            red_count += 1
        else:
            blue_count += 1

    if red_count == 0 or blue_count == 0:
        ans = 0
    else:
        ans = 2 * min(red_count, blue_count)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from collections import Counter

S = input()

cnt = Counter(list(S))
x = min(cnt['0'], cnt['1'])
print(x * 2)

Solution (Python):
S = input()

dif = 0
for s in S:
  if s == '1': dif += 1
  elif s == '0': dif -= 1
    
print(len(S)-abs(dif))

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

zero = 0
one = 0

for s in S:

    if s == '0':
        zero += 1
    elif s == '1':
        one += 1

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

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

for i in range(N):
    if S[i] == '1':
        A = A + 1

print(min(N - A, A)*2)

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

Solution (Python):



S = input()
ls = list(S)
ls = [int(x) for x in ls]

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

Solution (Python):
S = input()

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

print(len(S) - abs(c0 - c1))

Solution (Python):
S=input()
red=0
blue=0
ans=0
for i,s in enumerate(S):
    if i==0:
        if s=='0':
            red+=1
        else:
            blue+=1
    else:
        if s=='0':
            red+=1
        else:
            blue+=1
            
        if (red>0)and(blue>0):
            ans+=2
            red-=1
            blue-=1
print(ans)

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

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

Solution (Python):
from __future__ import print_function
import sys

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

cnt=0
S=list(input())


L=list()
L.append(S.pop())
while len(S)!=0:
    if S[-1]==L[-1]: 
        L.append( S.pop() )
        
        
    else: 
        S.pop()
        L.pop()
        if L==[] and S!=[]:
            L.append(S.pop())
        cnt=cnt+2
        
        

print(cnt)

Solution (Python):
from __future__ import print_function
import numpy as np
import sys

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

cnt=0
S=list(input())


L=list()
L.append(S.pop())
while len(S)!=0:
    if S[-1]==L[-1]: 
        L.append(S.pop())
        
        
    else: 
        S.pop()
        L.pop()
        if L==[] and S!=[]:
            L.append(S.pop())
        cnt=cnt+2
        
        

print(cnt)

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

b = 0
r = 0
for i in range(l):
    if S[i] == '0':
        r += 1
    else:
        b += 1

print(min(r,b) * 2)

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

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

Solution (Python):
S=input()

Zero=0
One=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()
blsum = 0
resum = 0
for i in S:
    blsum += 1 if i=="1" else 0
    resum += 1 if i=="0" else 0
print(min(blsum,resum)*2)

Solution (Python):
S = input().strip()
o = len([1 for s in S if s == '0'])
print(min(o,len(S)-o)*2)

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

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

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

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

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

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

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

stk=[]
ans=0

for c in s:
    if not stk or stk[-1]==c:
        stk.append(c)
    else:
        stk.pop()
        ans+=2

print(ans)

Solution (Python):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

s, = read_line(str)

s = [int(c) for c in s]

c = 0

ss = 0

for i in range(0, len(s)):
    if s[i] == 1:
        if ss < 0:
            c += 2
        ss += 1
    else:
        if ss > 0:
            c += 2
        ss -= 1
print(c)

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

Solution (Python):
S = input()

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

print(min(one,zero)*2)

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

if len(S) == 0:
    print(0)

else:
    
    s = 0
    for i in range(len(S)):
        s += int(S[i])

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

Solution (Python):
S = input()
N = len(S)
stack = []
removed = 0
for c in S:
    if len(stack) == 0 or stack[-1] == c:
        stack.append(c)
    else:
        stack.pop()
        removed += 2
print(removed)

Solution (Python):


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

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

Solution (Python):
S = input()

count0 = 0
count1 = 0
for i, s in enumerate(S):
    if s == '0':
        count0 += 1
    else:
        count1 += 1

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

Solution (Python):
s=input()
t=s.count("0")
e=s.count("1")
print(len(s)-(max(t,e)-min(t,e)))

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

Solution (Python):

s = input()
n = len(s)
a = []
i = 0
ct = 0
for i in range(n):
    a.append(int(s[i]))
i = -1

while ct < 100000000000:
    n = len(a)
    i += 1
    if i >= n - 1: break
    if a[i] == 0 and a[i + 1] == 1:
        a.pop(i)
        a.pop(i)
        ct += 1
        i -= 2
        if i <= 1: i = -1
        continue
    elif a[i] == 1 and a[i + 1] == 0:
        a.pop(i)
        a.pop(i)
        ct += 1
        i -= 2
        if i <= 1: i = -1

print(ct * 2)

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

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

print(N - abs(S.count('0') - S.count('1')))

Solution (Python):
s = input()

red=0
blue=0

for c in s:
    if c == "0":
        red += 1
    else:
        blue += 1

print(min(red, blue) * 2)

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

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

Solution (Python):
S  = list(input())
blue = S.count('1')
N = len(S)
red = N-blue
print(N-abs(blue-red))

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


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

Solution (Python):


import numpy as np













s = str(input())

num_0 = 0

for i in range(len(s)):
    if s[i] == "1":
        num_0 += 1
    
num_1 = len(s) - num_0
print(len(s) - abs(num_0 - num_1))

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

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 = str(input())
a = s.count("1")
b = s.count("0")
if a == b:
    print(2*a)
elif a > b:
    print(2*b)
elif a < b:
    print(2*a)

Solution (Python):


S = raw_input()

num1 = 0
num0 = 0

for s in S:
    if s == '1':
        num1 += 1
    else:
        num0 += 1

print '{}'.format(2*min(num0, num1))

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

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

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

C0, C1 = 0, 0
for i in S:
    if i == "0":
        C0 += 1
    else:
        C1 += 1
mini = min(C0, C1)
print(2 * mini)

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

slen = len(s)
start = 0
count = 0

while True:
    for i in range(start, slen - 1):
        if slist[i] != slist[i+1]:
            slist.pop(i)
            slist.pop(i)
            slen -= 2
            start = max(0, i - 1)
            count += 2
            break
    else:
        break


print(count)

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

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

Solution (Python):
s = input()
count0 = 0
count1 = 0
for i in range(len(s)):
    if s[i] == '0':
        count0 += 1
    elif s[i] == '1':
        count1 += 1

print(2 * min(count0, count1))