def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    for i in range(int(len(lists))):
        pre = 2
        for j, now in enumerate(lists):
            if(int(pre) < 2 and int(pre) != int(now)):
                del lists[j]
                del lists[j-1]
                #print(j, lists)
                break
            pre = lists[j]
    print(original_len - len(lists))
if __name__ == "__main__":
    main()

