function main(input) {
  var num = replaceLoop(input, 0);

  console.log(num*2);
}

function replaceLoop(input, execNum){
  if(newstr.length === '' | newstr === "00" | newstr === "11"){
    return execNum;
  }

  var newstr = input.replace(/01|10/, '');
  execNum++;
  return replaceLoop(newstr, execNum);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
