function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var S = inputStr[0];
  var i = 0;
  var counter = 0;
  var tmp = "";

  while(S.length >= 2 && i+1 < S.length ){  
    //console.log('i=$1',i);
    if (S.substr(i,1) != S.substr(i+1,1) ){
      //console.log(S.substr(i,1));
      //console.log(S.substr(i+1,1));
      
	  //console.log("捨てる");
      //iとi+1番目の配列要素を捨てる
	  tmp = S.substr(1,i) + S.substr(i+2)
      S = tmp;
      //console.log(tmp);
      counter += 2;
      i = 0;	//最初からやり直し
    } else {
      //次の要素に進める
      i += 1;
    }
  }
  console.log(counter);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
