#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e9
typedef long long ll;
typedef pair<ll,ll> P;
unsigned long long popCount64bitB(unsigned long long x) 
{ 
    x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) 
      +  (x & 0x5555555555555555UL); 
    x = ((x & 0xccccccccccccccccUL) >> 2) 
      +  (x & 0x3333333333333333UL); 
    x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) 
      +  (x & 0x0f0f0f0f0f0f0f0fUL); 
    x = ((x & 0xff00ff00ff00ff00UL) >> 8) 
      +  (x & 0x00ff00ff00ff00ffUL); 
    x = ((x & 0xffff0000ffff0000UL) >> 16) 
      +  (x & 0x0000ffff0000ffffUL); 
    x = ((x & 0xffffffff00000000UL) >> 32) 
      +  (x & 0x00000000ffffffffUL); 
    return x; 
} 

int main(void){
    int ans=0;
    string s;
    cin>>s;
    int i=0;
    if(s.length()==1)ans=1;
    else{
        string pre="";
        for(int i=0;i<s.length();i++){
            if(i+2==s.length()){
                if(s[i]==s[i+1]){
                    ans++;
                    i+=2;
                    continue;
                }
            }
            if(s.substr(i,2)==pre){
                pre=s.subsrt(i,2);
                i++;
            }
            else{
                pre=s.substr(i,1);
            }
            ans++;
        }
    }
    cout<<ans<<endl;
}