// 3
function Main(input){
  var tile = input.split('');
  var changeCount = 0;
  var changeFlag = false;
  for (let index = 1; index < tile.length; index++) {
    if(tile[index] == tile[index-1] && !changeFlag){
      changeFlag = true;
      changeCount ++;
    }
    else if(tile[index] != tile[index-1] && changeFlag){
      changeCount ++;
    }else{
      changeFlag = false;
    }
  }
  console.log(changeCount);
  }
  Main(require("fs").readFileSync("/dev/stdin","utf-8"));

  //4