cubes = input()

removed_cubes_count = 0

while True:
    removed_cubes = cubes.replace('01', '')
    removed_cubes = removed_cubes.replace('10', '')

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

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

    cubes = removed_cubes

print(removed_cubes_count)
