def extract(string, i):
    import re
    split = re.split('01|10', string)
    i += len(split) - 1
    split_concat = "".join(split)
    if "01" in split_concat or "10" in split_concat:
        return extract(split_concat, i)
    else:
        return i * 2

S = input()

print(extract(S,0))
