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)) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 int(i) for i in input().strip() for i in input().strip() i input().strip() ().strip () input strip for i in input().strip() int(i) int i s = [int(i) for i in input().strip()] s [int(i) for i in input().strip()] o = list() o list() list n = len(s) n len(s) 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) s v = s.pop() v s.pop() s.pop s pop if len(o) == 0:
        o.append(v)
    else:
        if v + o[-1] == 1:
            o.pop()
        else:
            o.append(v) len(o) == 0 len(o) len o 0 o.append(v) o.append o append v if v + o[-1] == 1:
            o.pop()
        else:
            o.append(v) v + o[-1] == 1 v + o[-1] v o[-1] o -1 1 o.pop() o.pop o pop o.append(v) o.append o append v print(n - len(o)) print n - len(o) n len(o) len o v = s.pop() s.pop() v s = [int(i) for i in input().strip()] [int(i) for i in input().strip()] s o = list() list() o n = len(s) len(s) n input = sys.stdin.readline sys.stdin.readline input
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))
