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

if s.count("1") >= s.count("0"):
  print(2*s.count("0"))
elif s.count("1") < s.count("0"):
  print(2*s.count("1"))

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

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

Solution (Python):
s=input()
t=s.count('0')
u=s.count('1')
ans=min(t,u)

print(2*ans)

Solution (Python):
import sys

def input():
    return sys.stdin.readline().rstrip()


def main():
    S =input()
    N = len(S)
    one = S.count("1")
    zero = N-one
    print(min(zero,one)*2)



if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    S =input()
    N = len(S)
    one = S.count("1")
    zero = N-one
    print(min(zero,one)*2)



if __name__ == "__main__":
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = input()

o = 0
z = 0
ans = 0
for i in range(len(s) - 1):
    if s[i] == '0':
        o += 1
    else:
        z += 1
    if s[i] != s[i + 1]:
        mi = min(o, z)
        ans += mi * 2
        o -= mi
        z -= mi

print(ans)

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

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

Solution (Python):
s = input()

ans = 0
ind = 0
while ind < len(s)-1:
    if s[ind:ind+2] in ("01", "10"):
        s = s[:ind]+s[ind+2:]
        ans += 1
        ind = max(0, ind-1)

    else:
        ind += 1
print(ans*2)

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

Solution (Python):

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

Solution (Python):

s = input()
n = len(s)
c = 0
p = ""
count = 0
for i in s:
    if i == p:
        count += 1
    else:
        c = count - c
        count = 1
    p = i
c = count - c
print(n - abs(c))

Solution (Python):
S = input()
r = S.count('0')
b = S.count('1')

print(min(r,b) * 2)

Solution (Python):
s = input()
r = 0
b = 0

for i in range(len(s)):
  if s[i] == '0':
    r += 1
  else:
    b += 1
if r > b:
  print(b*2)
else:
  print(r*2)

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

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

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

Solution (Python):
import collections
s = input()
c0 = s.count('0')
c1 = len(s) - c0
print(min(c0,c1)*2)

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

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

num0=s.count("0")
num1=s.count("1")
min=min([num0,num1])

print(min*2)

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

S = input().rstrip('\n')
N = len(S)

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

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

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

print(min(zero, one)*2)

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

Solution (Python):
S=input()



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

print(ans)

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

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

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

a, b = 0, 0
for i in range(n):
    if s[i] == '0':
        a += 1
    else:
        b += 1
print(min(a, b)*2)

Solution (Python):
s = input()
cnt0 = 0
cnt1 = 0
for c in s:
    if c == '0':
        cnt0 += 1
    else:
        cnt1 += 1

print(min(cnt0,cnt1)*2)

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

Solution (Python):

S = input()
N = len(S)
cnt0 = S.count("0")
cnt1 = S.count("1")
ans = 2*min(cnt0, cnt1)
print(ans)

Solution (Python):
S = input()

zero_count = int(S.count('0'))
one_count = int(S.count('1'))

print(min(zero_count, one_count)*2)

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

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

    print(ans)
    return
resolve()

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

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

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

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

Solution (Python):
from collections import Counter

S = list(input())

count = Counter(S)
n = min(count['0'], count['1'])
print(n * 2)

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

for i in s:
    if i == '1':
        cnt_1 += 1
        
print(min(cnt_1, len(s) - cnt_1) * 2)

Solution (Python):
S = input()

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

Solution (Python):
s=input()

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

if a>=b:
    print(b*2)

else:
    print(a*2)

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

count = 0

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

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

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

a = 0
b = 0

for i in S:
  if i =='0':
    a+=1
  else:
    b+=1

    
print(2*min(a,b))

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

Solution (Python):
s = input()

if len(s)>0:
    print(min(s.count("0"),s.count("1"))*2)

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

Solution (Python):
S=input()

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

print(ans*2)

Solution (Python):
s = input()

stack = [s[0]]
ans = 0
for i in range(1, len(s)):
    if len(stack) == 0:
        stack.append(s[i])
        continue
    if s[i] == "0":
        if stack[-1] == "1":
            del stack[-1]
            ans += 2
        else:
            stack.append("0")
    else:
        if stack[-1] == "0":
            del stack[-1]
            ans += 2
        else:
            stack.append("1")

print(ans)

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

print(2 * min(cnt_1, cnt_0))

Solution (Python):
S = input()

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

ans = 2 * min(C0, C1)
print(ans)

Solution (Python):
def resolve():
    inp = input()

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

    print(min(c0, c1)*2)

resolve()

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

Solution (Python):
from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

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

num = [0,0]
for i in s:
  num[i]+=1
print(min(num)*2)

Solution (Python):
from collections import defaultdict

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

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

d = [-1]
ans = 0
for i in s:
  if d[-1]+i==1:
    del d[-1]
    ans+=1
  else:
    d.append(i)
print(ans*2)

Solution (Python):
s = input()
n = len(s)
red = sum([ 1 for i in s if i == '0' ])
blue = n - red
print(n-abs(red-blue))

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

    c0 = 0
    c1 = 0

    for x in s:
        if x == 1:
            c1 += 1
        else:
            c0 += 1

    print(2*min(c0, c1))

if __name__ == '__main__':
    main()

Solution (Python):
s = input()
n = len(s)
ones = 0
for i in s:
  if i == '1':
    ones += 1
print(min(ones, n - ones) * 2)

Solution (Python):
S = list(map(int,list(input())))
count0 = S.count(1)
count1 = S.count(0)
print(2*min(count0,count1))

Solution (Python):
from  collections import Counter

s = list(input())

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

print(min(c0, c1)*2)

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil, floor, sqrt, gcd
from copy import deepcopy

def main():
    s = input()
    c_zero = s.count("0")
    c_one = s.count("1")
    num = min(c_one,c_zero)
    print(num*2)
    

if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7

S = list(s())
xx = Counter(S)
print(min(xx["0"],xx["1"])*2)

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

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

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

L = abs(S.count('0') - S.count('1'))

print(N - L)

Solution (Python):
from collections import deque
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

q = deque()
for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i)

print(N-len(q))

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

Solution (Python):
import collections

s = raw_input()
stack = collections.deque([])
i = 0
j = 0
while(j < len(s)):
	while(j < len(s) and s[i] == s[j]): j += 1	
	stack.append(j-i)
	i = j
n = len(s)
while(len(stack) > 1) :
	v = stack.pop()
	u = stack.pop()
	if v > u: 
		if stack:
			stack[-1] += v-u
		else:
			stack.append(v-u)
	elif v < u: stack.append( u - v)

print n - (stack[-1] if stack else 0)

Solution (Python):

import sys
sys.setrecursionlimit(1000000)

S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        print(ans)
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
S=input()
s=[]
for i in S:
    s+=[i]
ans=0
que=[]
que+=[s[0]]
def cube(i):
    global ans
    if i==len(s):
        print(ans)
    else:
        que.append(s[i])
        flag=True
        while flag:
            if len(que)==0 or len(que)==1:
                flag=False
            elif que[-1]==que[-2]:
                flag=False
            elif que[-1]!=que[-2]:
                del que[-1]
                del que[-1]
                ans+=2
        cube(i+1)
cube(1)

Solution (Python):
import collections
S = input()
T = collections.deque([])
for s in S:
    T.append(s)
stack = []
for t in T:
    if not stack:
        stack.append(t)
    else:
        if stack[-1] != t:
            stack.pop()
        else:
            stack.append(t)
print(len(T)-len(stack))

Solution (Python):
stack = []
top = -1

def push(x):
    global stack
    global top

    top += 1
    stack.append(x)

def pop2():
    global top
    global stack

    top -= 1
    stack.pop()

def main():
    global top
    global stack

    S = input()
    ans = 0

    for i in range(len(S)):
        if i == 0:
            push(S[0])
            continue

        push(S[i])
        if stack[top] != stack[top-1]:
            pop2()
            pop2()
            ans += 2
            continue

    return ans

print(main())

Solution (Python):
import sys

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

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    S = list(map(int, in_s()))
    ans = min(S.count(0), S.count(1))
    print(ans * 2)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

s = input()
n = len(s)
last = []
ans = 0
i = 0
last = []
while i<n:
    if last and s[i]!=last[-1]:
        ans += 2
        last.pop()
        i += 1
    else:
        last.append(s[i])
        i += 1
print(ans)

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

Solution (Python):
from collections import Counter

def solve():
    A = input()
    c = Counter(A)

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

print(solve())

Solution (Python):
import collections


def resolve():
    S = input()
    counter_S = collections.Counter(S)

    appear_0 = counter_S['0']
    appear_1 = counter_S['1']

    ans = min(appear_0, appear_1) * 2
    print(ans)


resolve()

Solution (Python):
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""
s=ip()
a=s.count('1')
b=s.count('0')
print(min(a,b)*2)

Solution (Python):
from collections import Counter


def main():
    s = list(input())
    Count = Counter(s)
    if "0" not in s or "1" not in s:
        ans = 0
        print(ans)
        exit()
    min_key = min(Count, key=Count.get)
    ans = Count[min_key] * 2
    print(ans)


if __name__ == "__main__":
    main()

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

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

count1=n-count0

if count0<=count1:
    ans=count0*2
else:
    ans=count1*2

print(ans)

Solution (Python):
ans = 0
now = 0 
for c in input():
    if c == '1':
        if now > 0:
            ans += 2
        now -= 1
    else:
        if now < 0:
            ans += 2
        now += 1
print(ans)

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

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

Solution (Python):
s = input()
k = len(s)
a = s.count('0')
b = s.count('1')
ans = 0
if a >= b:
  ans = k - a + b
else:
  ans = k + a - b
print(ans)

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

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

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


resolve()

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

Solution (Python):

s = input()
ans = 0
a = s.count('1')
b = s.count('0')
if a == 0 or b == 0:
    print(0)
    quit()
print(min(a, b)*2)

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

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

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

print(len(S) - abs(blue - red))

Solution (Python):
s = input()
c = max(s.count("1") - s.count("0"),s.count("0") - s.count("1"))

if len(s) == 1:
	print(0)
else:
	print(len(s)-c)

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

Solution (Python):
s = input()

c = max(s.count("1") - s.count("0"),s.count("0") - s.count("1"))

if len(s) == 1:
	print(0)
else:
	print(len(s)-c)

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

Solution (Python):
S = input()

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

Solution (Python):
s=list(map(int,list(input())))
from collections import Counter
s+=[0,1]
cs=Counter(s)
print(min(cs.values())*2-2)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

s=list(input())
n=len(s)



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

print(2*min(cnt0,cnt1))

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

Solution (Python):
S = input()

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

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

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

print(min(zero,one)*2)

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

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

print(ans)

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

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

Solution (Python):
S = input()

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

print(2*min(zero,one))

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

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

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

Solution (Python):
s = str(input())
apple = []
for i in s:
    apple.append(i)
a = apple.count("1")
b = apple.count("0")
print(2 * (min(a, b)))

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

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

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

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

Solution (Python):
S = input()
stack = []

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

print(cnt)

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

Solution (Python):

import math
from decimal import Decimal
from itertools import permutations


def inp():
    return(int(input()))



def inlist():
    return(list(map(int, input().split())))



def instr():
    s = input()
    return(list(s[:len(s)]))



def invr():
    return(map(int, input().split()))


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

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

Solution (Python):


s = list(str(input()))

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

print(min(count_0, count_1)*2)

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

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

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)

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

Solution (Python):


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

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

Solution (Python):
S = input()

s0 = 0
s1 = 0
for i in S:
    if i == "0":
        s0 += 1
    elif i == "1":
        s1 += 1
    
print(min(s0, s1) * 2)

Solution (Python):
import sys
from collections import deque

input = sys.stdin.readline


def main():
    S = input().rstrip()

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

    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
s = list(input())
c0 = s.count("0")
c1 = s.count("1")
if c0 >= c1:
    print(2*c1)
else:
    print(2*c0)

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

Solution (Python):
import collections
n=str(input())
lst=list(collections.Counter(n).most_common())
if len(lst)==1:
  print(0)
else:
  print(lst[1][1]*2)

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


if __name__ == '__main__':
    main()

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

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

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

if __name__ == '__main__':
    main()

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

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

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

print(len(s) - abs(one - zero))

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import fractions
import copy
from itertools import permutations
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

from itertools import permutations
from math import factorial, hypot


S = list(map(int, list(input())))
zerocounter = 0
onecounter = 0
for st in S:
    if st == 0:
        zerocounter += 1
    else:
        onecounter += 1
print(min(zerocounter, onecounter) * 2)

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

Solution (Python):
def main():
    s = input()
    cubes = []
    for c in s:
        if c == "0":
            cubes.append("red")
        else:
            cubes.append("blue")

    buffer = [] 
    buffer.append(cubes.pop()) 
    counter = 0
    while cubes:
        if len(buffer) <= 0 or buffer[-1] == cubes[-1]: 
            buffer.append(cubes.pop()) 
        else: 
            buffer.pop() 
            cubes.pop() 
            counter += 2 
    print(counter)




if __name__ == '__main__':
    main()

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

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

A = S.count(0)
B = len(S) - A

print(min(A, B) * 2)

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

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

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

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

Solution (Python):
S = input()

zeros = 0
ones = 0

for char in S:
  if char == '0':
    zeros += 1
  else:
    ones += 1
    
print(min(zeros, ones) * 2)

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

Solution (Python):
S = input()

ss = []
ans = 0
for i in range(len(S)): ss.append(S[i])

zeros = 0
ones = 0

for i in range(len(ss)):
    if ss[i] == "0":
        zeros += 1
    elif ss[i] == "1":
        ones += 1

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

Solution (Python):
S = input()

N = len(S)
O = S.count('1')
Z = N - O

print(2*min(O,Z))

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

Solution (Python):
import sys

import math


from collections import deque

from fractions  import gcd



s=list(map(int,input()))
n=len(s)
n0=n1=0
for i in range(n):
    if s[i]==1:
        n1+=1
    else:
        n0+=1
print(n-max(n0,n1)+min(n0,n1))

Solution (Python):
s=input()

l=list(s)

zeros = l.count('0')
ones = l.count('1')

if zeros<=ones:
    print(2*zeros)
else:
    print(2*ones)

Solution (Python):
S = list(input())
L = len(S)
from collections import Counter
c = Counter(S)
one = c['1']
zero = c['0']

print(L-abs(one-zero))

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

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

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

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

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

Solution (Python):
s = input()

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

print(min(cnt0, cnt1) * 2)

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

resolve()

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

r = 0
b = 0
ans = 0

for i in range(n):
    if s[i] == "0":
        r += 1
    elif s[i] == "1":
        b += 1
    
    if 0 < r and 0 < b:
        r -= 1
        b -= 1
        ans += 2

print(ans)

Solution (Python):
import sys
from collections import Counter
from collections import deque
import math
import fractions
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Solution (Python):
import sys
import numpy as np
from collections import Counter, deque

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


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


if __name__ == '__main__':
    resolve()

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

if __name__ == "__main__":
  resolve()

Solution (Python):
S = input().strip()
N = len(S)
k = 0
for i in range(N):
    if S[i]=="0":
        k += 1
m = min(k,N-k)
print(2*m)

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

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

Solution (Python):
s = input()
red = s.count("0")
blue = s.count("1")

ans = min(red,blue)

print(ans*2)

Solution (Python):




s=list(input())

count1=s.count("1")
count0=s.count("0")

print(min(count1,count0)*2)

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

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

Solution (Python):
s = input()
red = s.count("0")
blue = s.count("1")

ans = min(red,blue)

print(ans*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):
from collections import Counter
s = input()
S = [int(x) for x in list(str(s))]
if sum(S) == 0 or sum(S) == len(S)*1:
    print(0)
else:
    cnt = Counter(s)
    v = cnt.values()

    print(min(v)*2)

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

print(min(a,b)*2)

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

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

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

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

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

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

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