cubes = input()

removed_cubes_count = 0

while True:
    removed_cubes = cubes.translate({
        '01': '',
        '10': ''
    })

    removed_cubes_count += len(cubes) - len(removed_cubes)

    if len(cubes) == len(removed_cubes):
        break

    cubes = removed_cubes_count


print(removed_cubes_count)
