def main():
    s = input()
    if len(s) == 0:
        print(0)

    fix_flag = False; fix_counts = 0
    i = 0
    while True:
        if i >= len(s) - 1:
            if not fix_flag:
                print(fix_counts)
                return
            else:
                fix_flag = False
                i = 0
                continue
        if s[i] != s[i+1]:
            fix_counts += 2
            s = s[:i] + s[i+2:]
            fix_flag = True
        i += 1

if __name__ == '__main__':
    main()