[s] = [i for i in input().split()]
cnt = 0


def cube_cut(s, cnt):
    if "01" not in s or "10" not in s:
        print(cnt)
        exit(0)

    s2 = s.replace("01", '', 1)
    if s2 != s:
        cnt = cnt + 2
    s3 = s2.replace("10", '', 1)
    if s3 != s2:
        cnt = cnt + 2
    cube_cut(s3, cnt)


cube_cut(s, cnt)
