#include<bits/stdc++.h>
using namespace std;

#define int long long

signed main(){
   string s;
   cin >> s;
   string pre = "A" , cur;
   int size = (int)s.size();
   int same[size+5] = {0};
   same[size-1] = 1;
   int ans = 0;
   for(int i = size-2; i >= 0; i--){
       if(s[i] == s[i+1]){
           same[i] = (same[i+1] == 0 ) ? 0 : 1;
           same[i]+=same[i+1];
       }
   }
  
   for(int i = 0; i < size; i++){
              cur = ""; cur+=s[i];
              int rem = same[i];
              if(rem > 0){
                 ans += (rem/2 + rem%2); break;
              }
              if(cur != pre){
                 ans++;
              }
              else if(cur == pre){
                 cur+=s[i+1];
                 ans++; i++;
              }
              pre = cur;
   }
   cout << ans << '\n';
}