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

    zeroQue = []
    oneQue = []
    sIndex = 0
    out = 0

    for s in S:
        if s == '0':
            if len(oneQue) == 0:
                zeroQue.append(sIndex)
            else:
                out += 2
                oneQue.pop()

        else:
            if len(zeroQue) == 0:
                oneQue.append(sIndex)
            else:
                out += 2
                zeroQue.pop()

        sIndex += 1
    print(out)

if __name__ == '__main__':
    main()

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

Solution (Python):
S = input()
def main():
    cnt_0 = 0
    cnt_1 = 0
    for s in S:
        if s == '0':
            cnt_0 += 1
        if s == '1':
            cnt_1 += 1
    print(min(cnt_0, cnt_1)*2)

if __name__ == '__main__':
    main()

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

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

print(ans)

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

Solution (Python):
a = input()

cnt_0 = 0
cnt_1 = 0

for ele in range(len(a)):
    if a[ele] == '1':
        cnt_1 += 1
    else:
        cnt_0 += 1
        
print(2 * min(cnt_0, cnt_1))

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

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

Solution (Python):
S = input()

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

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

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())
zero = 0
one = 0

for i in s:
     if i == "0":
         zero += 1
     else:
         one += 1
if zero > one:
    print(one * 2)
else:
    print(zero * 2)

Solution (Python):
S = input()

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

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

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

Solution (Python):


s = str(input())

one = 0
zero = 0

for i in s:
    if i == "0":
        zero += 1
    else:
        one += 1
if zero > one:
    print(one * 2)
else:
    print(zero * 2)

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

Solution (Python):

s = list(map(int, input()))
cnt = 0
zero = s.count(0)
one = s.count(1)
print(zero*2 if zero < one else one * 2)

Solution (Python):

def main():
    s = input()
    num_zero, num_one = 0, 0
    for i in s:
        if i == "0":
            num_zero += 1
        else:
            num_one += 1
    num_pair = num_zero if num_zero < num_one else num_one

    print(num_pair*2)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
s=input()
a=[int(i) for i in s]
N=len(a)

count0=0
count1=0
for i in range(N):
  if a[i]==0:
    count0+=1
    
if count0>=N/2:
  print((N-count0)*2)
else:
  print(count0*2)

Solution (Python):
S = list(input())
n_0 = S.count("0")
n_1 = S.count("1")

print(2 * min(n_0, n_1))

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

num_0 = a.count("0")
num_1 = a.count("1")
print(len(a) - abs(num_0 - num_1))

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

Solution (Python):
import sys
s = sys.stdin.read().strip()
n = len(s)
print(2 * min(s.count("0"), s.count("1")))

Solution (Python):
"""C - Unification"""
S=list(input())
num0=S.count('0')
num1=len(S)-S.count('0')
print(min(num0,num1)*2)

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

Solution (Python):
s = input()
n = len(s)
count = 0
i = 0
while True:
  if i == n:
    break
  m = s[i:i+2]
  if m == '01' or m == '10':
    s = s[:i] + s[i+2:]
    count += 2
    if i != 0:
      i -= 1
  else:
    i += 1
print(count)

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

S = stdin.readline().rstrip()

stack = deque([])
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):
from sys import stdin

S = stdin.readline().rstrip()

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

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

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

for s in S:
    if s == "0":
        zero +=1
    elif s == "1":
        one += 1

print(min(zero, one) * 2)

Solution (Python):
S = input().strip()

count_0 = 0
count_1 = 0
for c in list(S):
    if c == "0":
        count_0 += 1
    else:
        count_1 += 1

if count_0 > 0 and count_1 > 0:
    print(2*min(count_0, count_1))
else:
    print(0)

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

S1 = S.count('1')
S0 = S_len - S1

if S0 < S1:
  print(S0*2)
else:
  print(S1*2)

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

zero_S = S.count('0')
one_S = S.count('1')

print(min(zero_S, one_S) * 2)

Solution (Python):
S = list(map(str, input().strip()))
num_of_zero = S.count('0')
num_of_one = S.count('1')
if num_of_zero <=  num_of_one:
    delete_num = 2 * num_of_zero
else:
    delete_num = 2 * num_of_one
print(delete_num)

Solution (Python):
def solve(s):
    odd = 0
    even = 0
    for c in s:
        if c == "0":
            even += 1
        else:
            odd += 1
    return 2*min(even, odd)

assert solve("0011") == 4
assert solve("11011010001011") == 12
assert solve("0") == 0

s = input()
print(solve(s))

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

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

print(cnt)

Solution (Python):
import re
S = input()

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

Solution (Python):
S = input()

zero_cnt = S.count("0")
one_cnt = S.count("1")

print( min(zero_cnt, one_cnt) * 2 )

Solution (Python):
import sys

S = list(input())
i = 0
cnt = 0

if len(S) == 1:
    print(0)
    sys.exit()

while True:
    if i == len(S) - 2:
        if S[i] != S[i+1]:
            cnt += 2
        break
    if S[i] != S[i+1]:
        cnt += 2
        S.pop(i)
        S.pop(i)
        if i > 0:
            i -= 1
    else:
        i += 1
print(cnt)

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

Solution (Python):
import numpy as np
s = list(input())

cnt = np.empty(2)
for i in range(len(s)):
    cnt[int(s[i]) - 0] += 1
ans = np.min(cnt) * 2
print(int(ans))

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

Solution (Python):
S = input()
c0, c1 = 0,0
ans = 0
for ch in S:
  if c0 == 0 and ch == '1':
    c1 += 1
  elif c1 == 0 and ch == '0':
    c0 += 1
  elif ch == '1':
    ans += 2
    c0 -= 1
  else:
    ans += 2
    c1 -= 1
    
print(ans)

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

Solution (Python):
S = input().strip()

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

print(2 * min(one,zero))

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

Solution (Python):

import sys


def solve(S: str):
    n = len(S)
    while True:
        l = len(S)
        i = 0
        while True:
            if i >= len(S) - 1:
                break
            if S[i] != S[i + 1]:
                S = S[:i] + S[i + 2:]
                i = max(i - 1, 0)
            else:
                i += 1
        if l == len(S):
            break
    print(n - len(S))
    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):
S = input()
lis = [x for x in S]
Z = lis.count("0")
O = lis.count("1")
print(2*min(Z, O))

Solution (Python):
from collections import deque
sin = input()
queue = deque(maxlen=len(sin))
for s in sin:
    if len(queue)>0 and queue[-1] != s:
        queue.pop()
    else:
        queue.append(s)

print(len(sin)-len(queue))

Solution (Python):



def solve(s):
    ans = 0
    c = 0
    p = 0

    for v in s:
        if c == 0:
            c += 1
            p = (v == '1')
        elif p ^ (v == '1'):
            ans += 2
            c -= 1
        else:
            c += 1

    return ans



def main():
    s = input()

    print(solve(s))


if __name__ == '__main__':
    main()

Solution (Python):

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

Solution (Python):



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

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
S = input()                                                                     

l = len(S)
stack = []
for i in S:
    if not stack or stack[-1] == i:
        stack.append(i)
    else:
        stack.pop()
print(l - len(stack))

Solution (Python):
s = input()
stack = []
r = 0
for c in s:
  n = int(c)
  if len(stack) > 0 and stack[-1] ^ n == 1:
    stack.pop()
    r += 2
  else:
    stack.append(n)
print(r)

Solution (Python):
from collections import Counter


def solve(string):
    count = Counter(string)
    return str(min(count.values()) * 2) if len(count.keys()) > 1 else "0"


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

Solution (Python):
x = input()
l = len(x)
l0 = sum([1 for c in x if c == '1'])
l1 = l - l0
if l1 < l0:
    print(l - l0 + l1)
else:
    print(l - l1 + l0)

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)
else:
    print(red * 2)

Solution (Python):

S=input()

num0=0
num1=0

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

print(min(num0,num1)*2)

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

N = len(S)
index = 0
count = 0
while index < len(S) - 1:
    if S[index] != S[index + 1]:
        del S[index:index + 2]
        index = max(0, index - 1)
        count += 1
    else:
        index += 1

print(2 * count)

Solution (Python):


if __name__ == "__main__":
    S = input()
    zero = S.count("0")
    print(2 * min(zero, len(S)-zero))

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

Solution (Python):

S=input()
x=0
y=0
N = len(S)
for i in range(0,N): 
 if S[i]=="0": 
       x+=1
 else:
       y+=1

if x>=y:
      print(2*(N-x))
else:
      print(2*(N-y))

Solution (Python):

import sys
import collections

def main():
	S = input()
	tmp = list(S)
	
	counts = collections.Counter(tmp)
	
	ans = min(counts["0"], counts["1"])
	
	print(ans * 2)
	
if __name__ == "__main__":
	main()

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

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

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

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

Solution (Python):
S = input()

a = [0,0]
ans = 0
for i in range(len(S)):
  if a[1] == 0 and S[i] == '0':
    a[0] += 1
  elif a[0] == 0 and S[i] == '1':
    a[1] += 1
  elif a[1] > 0 and S[i] == '0':
    ans += 2
    a[1] -= 1
  else:
    ans += 2
    a[0] -= 1
    
print(ans)

Solution (Python):
S = raw_input()
count_zeros = sum(1 if x == '0' else 0 for x in S)
print 2 * min(count_zeros, len(S) - count_zeros)

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

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

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

Solution (Python):
S = input()
print("{:d}".format(min(S.count('0'), S.count('1')) * 2))

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

Solution (Python):
def main120():
    import sys
    S_org = input()
    S = []

    for s in range(len(S_org)):
        S.append(S_org[s])
    S = list(map(int, S))

    cont = True
    index = 0
    count = 0

    if len(S) == 1:
        print(0)
        sys.exit()

    else:
        while(cont):
            if S[index] == S[index+1]:
                index += 1
            else:
                count += 2
                S.pop(index)
                S.pop(index)
                if index > 0:
                    index -= 1

            if index == len(S) - 2:
                if S[index] != S[index+1]:
                    count += 2
                print(count)
                sys.exit()


main120()

Solution (Python):
S = input()
i = 0
ans = 0
while i < len(S) - 1:
    if S[i] != S[i+1]:
        S = S[:i] + S[i+2:]
        ans += 2
        if i > 0:
            i -= 1
    else:
        i += 1
print(ans)

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

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

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

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

Solution (Python):
s = input()
one = s.count("1")
zero = s.count("0")
ans = 0
if one!=0 or zero!=0:
    if one > zero:
        ans = zero * 2
    else:
        ans = one * 2

print(ans)

Solution (Python):
str=input()

blue=0
red=0
for color in str:
    if color=="1":
        blue+=1
    else:
        red +=1

print(2*min(blue, red))

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

a_count = 0
b_count = 0
for i in range(len(A)):
    if A[i] == '0':
        a_count += 1
    else:
        b_count += 1
print(min(a_count, b_count) * 2)

Solution (Python):
s = input()

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

print(2 * min(one, zero))

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

Solution (Python):
s = input()

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

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

Solution (Python):
S = input()

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

print(2 * min(cnt0, cnt1))

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

Solution (Python):
S=input()
N=len(S)
c0=0;c1=0
for i in range(N):
  if "0"==S[i]:
    c0=c0+1
  elif "1"==S[i]:
    c1=c1+1
print(str(2*min(c0,c1)))

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

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

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

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

print(ans)

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

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

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

Solution (Python):
L = list(input())
cnt_0 = L.count("0")
cnt_1 = L.count("1")

print(min(cnt_0, cnt_1) * 2)

Solution (Python):
L = list(input())
L_ = []
a = L.pop(0)
cnt = 0

while True:
    if len(L) == 0:
        break
    else:
        b = L.pop(0)
    if a is not b:
        cnt += 1
        if len(L_) != 0:
            a = L_.pop()
        elif len(L) == 0:
            break  
        else:
            a = L.pop(0)
    elif a is b:
        L_.append(a)
        a = b
    

print(cnt * 2)

Solution (Python):
S = input()
red = 0
blue = 0

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

print(2*min(red, blue))

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

Solution (Python):
list = []
cnt = 0

for i in input():
    if list:
        if list[-1] != i:
            list.pop(-1)
            cnt += 2
        else:
            list.append(i)
    else:
        list.append(i)

print(cnt)

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

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

print(min(zero,one)*2)

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

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

print(min(r, b) * 2)

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

Solution (Python):
from collections import Counter

s = input()
c = Counter([s_ for s_ in s])
sums = c["0"] + c["1"]
print(sums - (max(c["0"], c["1"]) - min(c["0"], c["1"])))

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

Solution (Python):


string = input()

red_count  = string.count('0')
blue_count = string.count('1')

print(min(red_count, blue_count) * 2)

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

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):
S=list(input())
red=0
blue=0
for s in S:
    if s=="0":
        red+=1
    elif s=="1":
        blue+=1
print(min(red,blue)*2)

Solution (Python):
def solve(s):
    import collections
    l = collections.deque()

    cnt = 0
    for x in map(int,s):
        if len(l) == 0:
            l.append(x)
            continue
        y = l[-1]
        if x + y == 1:
            l.pop()
            cnt += 2
        else:
            l.append(x)

    return cnt


print(solve(input()))

Solution (Python):
S = input()

zero = 0
one = 0
for n in S:
  if n == "0":
    zero+=1
  elif n == "1":
    one+=1

print(min(zero,one)*2)

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

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

a = ns()

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

Solution (Python):



import copy

string = [x for x in input()]

concat_string = copy.copy(string)
num_delete = 0

i = 0
j = 1
not_delete_list = []
while True:
    if j >= len(concat_string) or i < 0:
        break
    if concat_string[i] != concat_string[j]:
        num_delete += 2
        
        if i == 0:
            i = j + 1
            j = i + 1
        else:
            if len(not_delete_list) > 0:
                i = not_delete_list.pop(-1)
                j = j + 1
            else:
                i = j + 1
                j = i + 1
    else:
        not_delete_list.append(i)
        i = j
        j = i + 1


print(num_delete)

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

Solution (Python):
a = input()
print(min(a.count('1'), a.count('0'))*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 = 2*min(s.count('0'), s.count('1'))
print(ans)

Solution (Python):
bit_string = raw_input()
  
count_zero = bit_string.count('0')
count_one  = bit_string.count('1')
print((min(count_zero, count_one) * 2))

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

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

Solution (Python):
A = input()

C0 = A.count('0')
C1 = A.count('1')
print(2*min(C0,C1))

Solution (Python):
A = input()

len0 = lenA = len(A) 
while(True):
    A = A.replace("10","").replace("01","").replace("1"*1000 + "0"*1000,"").replace("0"*1000 + "1"*1000,"")
    if lenA == len(A):
        break
    lenA = len(A)
print(len0 - lenA)

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

Solution (Python):
from collections import Counter

s = Counter(input())
red = s['0']
blue = s['1']
print(min(red,blue)*2)

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

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

Solution (Python):
s = input()

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

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

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

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

Solution (Python):
S = input()

num_0 = S.count('0')
num_1 = S.count('1')

print(min(num_0, num_1)*2)

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

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

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

Solution (Python):
S = [int(i) for i in input()]
count =[0]*2
for i in S:
    count[i] += 1
print(min(count)*2)

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

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

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

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

Solution (Python):
cnt_dict = {'0':0, '1':0}
S = list(input())
for s in S:
    cnt_dict[s] += 1
print(min(cnt_dict['0'], cnt_dict['1']) * 2)

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

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()

stack = []
ans = 0

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

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

ones = sum(S)
zeros = N - ones
print(2*min(ones,zeros))

Solution (Python):
s = input()
zero = []
one = []
for i in range(len(s)):
    if s[i] == '0':
        zero.append(i)
    else:
        one.append(i)
n0 = len(zero)
n1 = len(one)
print(min([n0, n1]) * 2)

Solution (Python):


S = input()

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

print(min(red, blue)*2)

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

Solution (Python):
S = input()

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

print(min(cnt0, cnt1) * 2)

Solution (Python):
S = input()

numred = 0
numblue = 0

for c in S:
    if c == '0':
        numred += 1
    else:
        numblue += 1

print(2 * min(numred, numblue))

Solution (Python):
cube = input()

zero_count = 0
one_count = 0

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

if zero_count < one_count:
    print(zero_count * 2)
else:
    print(one_count * 2)

Solution (Python):
S=[int(x) for x in input()]
o = sum(S)
z = abs(len(S)-o)
print(min(o,z)*2)

Solution (Python):
S=[int(x) for x in input()]
d = sum(S)
l = len(S)
print(l-abs(2*d-l))

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

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

Solution (Python):



counter = 0

string = input()

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

print(min(num_0, num_1)*2)

Solution (Python):
S = input()
sumOne = 0
sumZero = 0
for i in range(len(S)):
  if S[i] == "1":
    sumOne +=1
  else:
    sumZero +=1
if sumOne < sumZero:
  print(sumOne*2)
else:
  print(sumZero*2)

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

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

Solution (Python):
S = input()

numbers = [int(S[i]) for i in range(len(S))]

one_count = sum(numbers)
zero_count = len(numbers) - one_count

print(2*min(one_count, zero_count))

Solution (Python):
s = input()

n0 = 0
n1 = 0

for i in range(0,len(s)):
    if(s[i] == '1'):
        n1 += 1
    else:
        n0 += 1

print(min(n1,n0) * 2)

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

Solution (Python):
cnt0 = 0
cnt1 = 0

nums = input()
for i in range(len(nums)):
  if nums[i] == '0':
    cnt0 += 1
  else:
    cnt1 += 1
  
print(len(nums) - abs(cnt0 - cnt1))

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

Solution (Python):
S = input()

number0 = S.count("0")
number1 = S.count("1")

answer = min(number0, number1) * 2

print(answer)

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

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

r = 0
w = 0
for c in S:
    if c == "0":
        r += 1
    else:
        w += 1

if r == w:
    print(len(S))
else:
    print(len(S) - (max(r,w) - min(r,w)))

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

Solution (Python):
S=list(input())
a=S.count("1")
b=S.count("0")
if a>=b:
    print(b*2)
else :
    print(a*2)

Solution (Python):
s = input()

ans = 0

s_0 = s.replace('0', '')
n_0 = len(s) - len(s_0)
s_1 = s.replace('1', '')
n_1 = len(s) - len(s_1)

print(2 * min(n_0, n_1))

Solution (Python):

import sys


def solve(S: str):
    S = list(map(lambda x:int(x), S))
    zeros = len(list(filter(lambda x:x==0, S)))
    ones = len(list(filter(lambda x:x==1, S)))
    print(2*min(zeros, ones))
    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):
S = input()
zero = S.count('0')
one = S.count('1')
print(min(zero,one)*2)

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

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

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

Solution (Python):
import collections
s = list(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()
x=0
for i in s:
        if i=="0":
                x+=1
        else:
                x-=1
print(len(s)-abs(x))

Solution (Python):
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])
    if S[i] == 0:
        S[i] = -1

now = S[0]
cnt = 1
ans = 0
for i in range(1, len(S)):
    
    if cnt > 0:
        if S[i] != now:
            ans += 2
            cnt -= 1
            now = S[i] * -1
        else:
            cnt += 1
            now = S[i]
    else:
        now = S[i]
        cnt += 1

print(ans)

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


if __name__ == "__main__":
    main()

Solution (Python):

s = list(input())
s = [int(i) for i in s]
n = 0
r = 0
b = 0
for i in s:
	if s[n] == 0:
		r += 1
	elif s[n] == 1:
		b += 1
	n += 1
print(min(r,b) * 2)

Solution (Python):

s = input()

n = len(s)

stack = [ s[0] ]

rem = 0




ss = len(stack)

for i in range(1,n):


    if ss==0 or stack[-1] == s[i]:

        stack.append(s[i])
        ss+=1
        
        continue


    
    stack.pop()
    ss -= 1
    i+=1
    rem +=2


print(rem)

Solution (Python):
def check(P):
    for i in range(len(P)-1):
        if P[i] != P[i+1]:
            return i
    return "Non"
def min_2(a,b):
    if a < b:
        return a
    else:
        return b
P = list(input())
c0 = P.count("0")
c1 = P.count("1")
print(min_2(c0,c1)*2)

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

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

Solution (Python):


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

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

Solution (Python):
def func(line):
    lp = 0
    res = []
    while lp < len(line):
        while len(res) > 0 and lp < len(line) and res[-1] != line[lp]:
            res.pop()
            lp += 1
        if lp < len(line):
            res.append(line[lp])
            lp += 1
    return res


def main():
    line = [i for i in input()]
    startsize = len(line)
    line = func(line)
    lastsize = len(line)
    print(startsize - lastsize)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    cnt = [0, 0]
    for c in S:
        cnt[int(c)] += 1
    print(min(cnt) * 2)


if __name__ == "__main__":
    main()

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

Solution (Python):

"""
Created on Sun Mar  3 19:52:53 2019

@author: Yamazaki Kenichi
"""
S = input()
print(2*min(S.count('0'),S.count('1')))