if __name__ == '__main__':
    S = input()
    c = 0
    while(1):
        d = S.count('1100')
        if d > 0:
            S = S.replace("1100", "")
        e = S.count('0011')
        if e > 0:
            S = S.replace("0011", "")
        a = S.count('01')
        if a > 0:
            S = S.replace("01", "")
        b = S.count('10')
        if b > 0:
            S = S.replace("10", "")
        num = a+b+d+e
        if num == 0:
            print(c*2)
            exit()
        c += num