const main = (input) => {
  var inputs = input[0].split("");
  var N = inputs.length;

  var arr = [inputs[0]];
  for(var i=1;i<N;i++){
    var w = inputs[i];
    if(arr[arr.length-1] != w){
      arr.push(w);
    }else if(i<N-1){
      arr.push(w + inputs[i+1]);
      i++;
    }else{
      arr = [];
    }
  }

  var arr2 = [inputs[0] + inputs[1]];
  for(var i=2;i<N;i++){
    var w = inputs[i];
    if(arr2[arr2.length-1] != w){
      arr2.push(w);
    }else if(i<N-1){
      arr2.push(w + inputs[i+1]);
      i++;
    }else{
      arr2 = [];
    }
  }
  console.log(Math.max(arr.length, arr2.length));

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
