const main = (input) => {
  var inputs = input[0].split("");
  var ans1 = calc(inputs);
  inputs = inputs.reverse();
  var ans2 = calc(inputs);
  console.log(Math.max(ans1, ans2));
}

function calc(inputs){
  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(inputs[i+1]){
        arr.push(w + inputs[i+1]);
      }
      i++;
    }
  }
  if(N>1){
    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(inputs[i+1]){
          arr2.push(w + inputs[i+1]);
        }
        i++;
      }
    }
  }else{
    arr2 = [];
  }
  return Math.max(arr.length, arr2.length);
}

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