def main():
    string = input()
    lists = list(string)
    original_len = len(lists)
    zero = lists.count('0')
    one = lists.count('1')
    print(original_len - min(zero,one)+2)
if __name__ == "__main__":
    main()

