#include <iostream>
using namespace std;

int main(){
  string s;
  cin >> s;
  int ans=1;
  int n=s.size();
  char c=s[0];
  for(int i=1;i<n;i++){
    if(s[i]==c||i==n-2&&s[i]==s[i+1]){
      i++; c='A';
    }
    else c=s[i];
    ans++;
    cerr << c << endl;
  }
  cout << ans << endl;
}