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

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

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

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

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

Solution (Python):
from collections import Counter
S = str(input())
c = Counter(S)
d = c.most_common()
if len(d) == 2:
  ans = d[1][1] * 2
  print(ans)
else:
  print(0)

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

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

print(min(a,b)*2)

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

Solution (Python):
S = input()
z = S.count("0")
o = S.count("1")

print(len(S)-abs(z-o))

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

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

print(2 * min(c0,c1))

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

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

Solution (Python):
import sys

cubes = list(input()) 
stack = []
count = 0

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

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

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

Solution (Python):
def main():
    
    
    
    s = list(input())
    
    count0 = 0
    count1 = 0
    for i in s:
        if i == "0":
            count0 += 1
        else:
            count1 += 1

    print(min(count0, count1)*2)


if __name__ == '__main__':
    main()

Solution (Python):
S=input()
a=S.count('0')
b=S.count('1')
print(min(a,b)*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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = [int(i) for i in input().strip()]
o = list()
n = len(s)

while s:
    v = s.pop()
    if len(o) == 0:
        o.append(v)
    else:
        if v + o[-1] == 1:
            o.pop()
        else:
            o.append(v)
print(n - len(o))

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

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

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    cnt0 = s.count("0")
    cnt1 = s.count("1")

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

Solution (Python):
def main():
    S = input()
    d = {'0': 0, '1': 0}
    for s in S:
        d[s] += 1
    print(min(d.values()) * 2)


if __name__ == '__main__':
    main()

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

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

stdin = sys.stdin

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

s = ns()
n = len(s)
b = s.count('0')
r = n - b
print(2 * min(b, r))

Solution (Python):
s = input()
zero = 0
one = 0
for i in s:
  if i == '0':
    zero += 1
  else:
    one += 1
ans = min(one, zero)
print((ans) << 1)

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

Solution (Python):

"""
Created on Mon Sep 14 01:36:50 2020

@author: liang
"""

S = input()
c0 = 0
c1 = 0
for i in range(len(S)):
    if S[i] == "0":
        c0 += 1
    else:
        c1 += 1
ans = len(S) - abs(c0-c1)
print(ans)

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

Solution (Python):

def resolve():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    r = 0
    b = 0
    for c in s:
        if c == "0":
            r += 1
        else:
            b += 1

    print(min(r, b) * 2)


if __name__ == "__main__":
    resolve()

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):
a=list(input())
temp1=0
temp0=0

for i in range(len(a)):
    if a[i]=="0":
        temp0+=1
    else:
        temp1+=1
print(min(temp0,temp1)*2)

Solution (Python):



from collections import Counter
import sys

S = input()

c = Counter(S)

print(len(S) - abs(c["0"] - c["1"]))

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

print(min(a,b)*2)

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

main()

Solution (Python):









import os
import sys




def main():
    S = input()
    if S.count('0') < S.count('1'):
        print(S.count('0')*2)
    else:
        print(S.count('1')*2)


if __name__ == "__main__":
    main()

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

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

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

print(2*min(b,w))

Solution (Python):
s=input()
num_0=0
num_1=0
for i in range(len(s)):
  if s[i]=="0":
    num_0+=1
  else:
    num_1+=1

print(min(num_0,num_1)*2)

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

Solution (Python):
s=input()

num_0 = 0
num_1 = 0
for i in range(len(s)):
  if s[i] == '0':
    num_0 += 1
  else:
    num_1 += 1
    
print(min(num_0,num_1)*2)

Solution (Python):
S = 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):
N = str(input())
one = N.count('1')
zero = N.count('0')

print(min(one,zero)*2)

Solution (Python):
S = list(input())
N = len(S)
len0 = S.count('0')
len1 = S.count('1')
rm = min(len0,len1)
print(2*rm)

Solution (Python):
S=input()
n0,n1=0,0
for s in S:
  if s=='1':
    n1+=1
  elif s=='0':
    n0+=1
print(min(n1,n0)*2)

Solution (Python):
from collections import deque

S = input()

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

print(cnt)

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

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

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


if __name__ == "__main__":
    main()

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

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

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()

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


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
stack_0 = []
stack_1 = []

for s in S:
    if s == "0":
        if stack_1:
            stack_1.pop()
        else:
            stack_0.append(s)
    else:
        if stack_0:
            stack_0.pop()
        else:
            stack_1.append(s)

print(len(S) - len(stack_0) - len(stack_1))

Solution (Python):
S = str(input())
x = len(S)
if '0' in S:
  y0 = S.count('0')
else:
  y0 = 0
if '1' in S:
  y1 = S.count('1')
else:
  y1 = 0
  
d = abs(y0 - y1)
print(x - d)

Solution (Python):
S = input()

zero_count=S.count("0")
one_count=S.count("1")

ans=2*min(int(zero_count),int(one_count))
print(ans)

Solution (Python):
s = input()

z = 0
o = 0
for c in s:
    if c == '1':
        o += 1
    else:
        z += 1

print(min(o, z) * 2)

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

Solution (Python):


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter  
from itertools import combinations as comb  
from itertools import permutations as permutate
from bisect import bisect_left as bl



from bisect import bisect_right as br
from bisect import bisect







BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)





from types import GeneratorType


def iterative(f, stack=[]):
    def wrapped_func(*args, **kwargs):
        if stack: return f(*args, **kwargs)
        to = f(*args, **kwargs)
        while True:
            if type(to) is GeneratorType:
                stack.append(to)
                to = next(to)
                continue
            stack.pop()
            if not stack: break
            to = stack[-1].send(to)
        return to

    return wrapped_func







mod = 1000000007


def inp(): return sys.stdin.readline().rstrip("\r\n")  


def out(var): sys.stdout.write(str(var))  


def lis(): return list(map(int, inp().split()))


def stringlis(): return list(map(str, inp().split()))


def sep(): return map(int, inp().split())


def strsep(): return map(str, inp().split())


def zerolist(n): return [0] * n


def nextline(): out("\n")  


def testcase(t):
    for p in range(t):
        solve()


def printlist(a):
    for p in range(0, len(a)):
        out(str(a[p]) + ' ')

import heapq as hp
from math import ceil
def solve():
    s=inp()
    k=s.count("0")
    n=len(s)-k
    print(2*min(k,n))


    







solve()

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

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

s = list(input().strip())
r = s.count('0')
b = s.count('1')
print(2*min(r,b))

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

Solution (Python):
S = input()
x = S.count('0')
y = S.count('1')

ans = 2 * (min(x, y))
print(ans)

Solution (Python):
S = input()

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

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

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

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    S = SS()

    ans = 0
    stk = []
    for i in S:
        if stk and stk[-1] != i:
            stk.pop()
            ans += 2
        else:
            stk.append(i)

    print(ans)

if __name__ == '__main__':
    resolve()

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

print(min(cnt_0, cnt_1)*2)

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

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

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

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

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

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

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

print(2*min(one,zero))

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

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

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

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

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

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

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

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

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

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

Solution (Python):

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

print(2 * min(a, b))

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
sys.setrecursionlimit(500*500)
import itertools
from collections import Counter,deque

def main():

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

if __name__=="__main__":
    main()

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

Solution (Python):
S = input().rstrip()
T = []
cnt = 0
for s in S:
    if not T:
        T.append(s)
        continue
    if s!=T[-1]:
        cnt += 2
        T.pop()
    else:
        T.append(s)
print(cnt)

Solution (Python):
S = input()

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

if zero != 0 and one != 0:
  print(min(zero,one)*2)
else:
  print(0)

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

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

length = len(s)

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

print(length - abs(r-b))

Solution (Python):
import math
from collections import Counter
s = list(input())
s = list(map(int, s))
dict_s = Counter(s)

print((min(dict_s[0], dict_s[1]))*2)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    red = S.count('0')
    blue = len(S) - red

    print(min(red, blue) * 2)

    return


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
l0 = S.count("0")
l1 = len(S) - l0

print(2 * min([l0, l1]))

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

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

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

Solution (Python):
def readinput():
    s=list(input())
    return s

def main(s):
    n=len(s)
    count=0
    for i in range(n):
        if s[i]=='1':
            count+=1
    return min(count,n-count)*2

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)

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

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

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

print(ans*2)

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

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

n = a.count("0")
m = a.count("1")

print(min(n, m) * 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()
cnt=0
for i in range(len(s)):
  if s[i]=='0':
    cnt+=1
print(min(cnt,len(s)-cnt)*2)

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

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

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

Solution (Python):
S = input()

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):
"""
int(input())
map(int, input().split())
list(map(int, input().split()))
input()
input().split()
"""

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

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7


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

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

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

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

Solution (Python):
s=list(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=sorted(input())
import bisect

i=bisect.bisect_right(S,'0')
o=len(S)-i
z=i
print(len(S)-abs(o-z))

Solution (Python):
s=[int(x) for x in list(input())]
x=s.count(0)
print(min(x,len(s)-x)*2)

Solution (Python):
S = input().strip()
z = 0
o = 0
r = 0
for s in S:
    if s == "0":
        if o > 0:
            o -= 1
            r += 2
        else:
            z += 1
    elif s == "1":
        if z > 0:
            z -= 1
            r += 2
        else:
            o += 1
print(r)

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

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

print(min(zero, one) * 2)

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

print(min(zero, one)*2)

Solution (Python):

import sys

def solve(S: str):
    from collections import Counter
    c = Counter(S)
    return 2 * min(c["0"], c["1"])


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

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):

import sys

def solve(S: str):
    stack = [-1]
    for c in map(int, S):
        if stack[-1] + c == 1:
            stack.pop()
            continue
        stack.append(c)
    return len(S)-len(stack)+1


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

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    
    main()

Solution (Python):
import sys
from collections import deque


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    S = list(map(int, list(input())))
    d_1 = deque(S[1:])
    d_2 = deque([S[0]])
    ans = 0
    for i in range(1, len(S)):
        if d_2:
            r = d_1.popleft()
            l = d_2.pop()
            if r != l:
                ans += 2
            else:
                d_2.append(l)
                d_2.append(r)
        else:
            d_2.append(d_1.popleft())
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()

s_0 = s.count("0")
s_2 = s.count("1")

print(min(s_0,s_2)*2)

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

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

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

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

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

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

Solution (Python):
S = input()

length = len(S)
total = 0
for i in list(S):
    total += int(i)

if (length - total) > total:
    answer = total * 2
else:
    answer = (length - total) * 2

print(answer)

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

print(min(red,blue)*2)

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

Solution (Python):
S = input()
chara0 = S.count('0')
chara1 = S.count('1')
if chara0 < chara1:
    print(chara0 * 2)
else:
    print(chara1 * 2)

Solution (Python):
s = input()
n = len(s)
stack = []
for i in s:
    if stack and stack[-1] != i:
        stack.pop()
    else:
        stack.append(i)
print(n - len(stack))

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

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

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

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

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

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

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

i = 0
count = 0
while i < len(S)-1:
  if S[i] != S[i+1]:
    del S[i:i+2]
    count += 2
    if i != 0:
      i -= 1
  else:
    i += 1
print(count)

Solution (Python):
s = input()

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

print(min([c0*2,c1*2]))

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

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

Solution (Python):
s = input()
n = len(s)
a, b = 0, 0
for i in s:
  if i == '1':
    a+=1
b = n-a

print(min(a,b)*2)

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

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

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

num1 = sum(S)
num0 = len(S) - num1

print(min(num1,num0)*2)

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

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

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

Solution (Python):
def main():
    s = input()
    kazu = len(s)
    onelen = 0
    zerolen = 0
    
    for i in range(kazu):
        if s[i] == "1":
            onelen += 1
        else:
            zerolen += 1
    
    print(min(onelen, zerolen) * 2)


if __name__ == "__main__":
    main()

Solution (Python):
s=list(input())
n=len(s)
a=s.count('1')
b=n-a
c=abs(a-b)
print(n-c)

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

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()
zero,one=0,0
for i in range(len(s)):
  if s[i]=="0":
    zero+=1
  else:
    one+=1
print(min(zero,one)*2)

Solution (Python):
def resolve():
    s = input()
    cnt_zero = s.count('0')
    cnt_one = s.count('1')

    print(min(cnt_one, cnt_zero) * 2)
    
resolve()

Solution (Python):
S = input()
from collections import deque
q = deque()
ans = 0
for s in S:
    if not q:
        q.append(s)
        continue
    pres = q.pop()
    if (s == '0' and pres == '1') or (s=='1' and pres=='0'):
        ans += 2
    else:
        q.append(pres)
        q.append(s)
print(ans)

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

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

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

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

print(2*min(cnt_0, cnt_1))

Solution (Python):


import sys


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

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

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

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

print(2 * min(count0, count1))

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

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

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

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

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












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

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
s = input()
one = s.count('1')
zero = s.count('0')
print(one * 2 if one < zero else zero*2)

Solution (Python):
s = list(input())
red = s.count("0")
blue = len(s) - red

print(min(red, blue)*2)

Solution (Python):
s = input()

zero = 0
one = 0

for c in s:
    if c == '1':
        one +=1
    else :
        zero +=1

print(min(one,zero)*2)

Solution (Python):
s = input()

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

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

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

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

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

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

print(2*min(c0, c1))

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

Solution (Python):
s = input()

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

Solution (Python):
S = input()

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

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

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

def main():
    s = list(input())
    print(min(s.count('0'), s.count('1')) * 2)
        
if __name__ == '__main__':
    main()