def main():
    s = input()

    count = 0

    deleted = True
    while deleted:

        deleted = False
        p = s.replace("01", "")

        if (len(s) != len(p)):
            deleted = True

        count += len(s) - len(p)
        s = p
        p = s.replace("10", "")

        if (len(s) != len(p)):
            deleted = True

        count += len(s) - len(p)
        s = p

    print(count)



if __name__ == "__main__":
    main()