#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e18;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power((((a%mod)*(a%mod))%mod),b/2)%mod;
    else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
}

int32_t main()
{
    IOS
     
    
    string s;
    int count=1;
    map<string,int> m;
    cin>>s;
    int n=s.length();
    int count1[n+1];
    memset(count1,0,sizeof(count1));
    count[0]=1;
    for(int i=1;i<n;++i)
    {
        if(count1[i-1]==2)
        {
            count1[i]=1;
            count++;
            continue;
        }
        if(s[i]==s[i-1] and i!=n-1)
        {
            //cout<<s[i]<<" "<<endl;
            count1[i]=2;
            count1[i+1]=2;
            i++;
            count++;
        }
        else if(s[i]!=s[i-1])
        {
            count1[i]=1;
            count++;
        }
    }
    cout<<count;

}

