const exec = (input) => {
  const rep = input.replace(/(01|10)/g, "")
  if (rep == input) {
    return rep
  }
  return exec(rep)
}

// @ts-ignore
require("fs").readFile("/dev/stdin", "utf8", (err, input) => {
  const inp = input.replace("\n", "")
  const cnt = exec(inp)
  console.log(inp.length - cnt.length)
})
