const exec = (input) => {
  let inp = input
  for (let i = 0; i < inp.length; i++) {
    const rep = input.replace(/(01|10)/g, "")
    if (rep == input) {
      return rep
    }
    inp = 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)
})
