function Main(input) {
  var output = 0;
  var list = [];
  var output = input.length;
  var tmp = "";
  for(var i = input.length - 1; i >= 0; i--){
    var tmp2 = input.slice(i, i + 1);
    //console.log(list)
    if(list.length == 0){
      list.push(tmp2);
      continue;
    }else{
      var tmp1 = list[list.length - 1];//前の値
      if(tmp1 == tmp2){
         var tmp3 = input.slice(i - 1, i);
         if(tmp2 != tmp3){
            list.push(tmp3 + tmp2);
            i--;
         }else{
           var same = 1;
           var count = 1;
           while(true){
              var tmp4 = input.slice(i - count, i - (count - 1));
             count++;
              if(tmp3 == tmp4){
                 same++;
              }else{
                break;
              }
           }
           //console.log(same);
           if(same % 2 == 1){
              list.push(tmp3 + tmp2);
              i--;
             continue;
           }else{
              var tmp4 = input.slice(i - 2, i - 1);
              list.push(tmp3 + tmp2 + tmp4);
              i = i - 2;
             continue;
           }
         }
      }else{
        list.push(tmp2);
      }
    }
  }
  
  if(list[list.length - 2] == list[list.length - 1]){
     list[list.length - 2] = list[list.length - 2] + list[list.length - 1];
    list.length--;
     }
  
  output = list.length;
  
  //console.log(list);
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
