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

  console.log(num*2);
}

function replaceLoop(input, execNum){
  console.log(input);
  if(input === '' | input === '00' | input === '11'){
    return execNum;
  }
  var newstr = input.replace(RegExp(/01|10/), '');
  execNum++;
  return replaceLoop(newstr, execNum);
}

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