#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define endl '\n'
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ull unsigned long long
#define int long long
#define iter set<int>::iterator
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1e5+7;
const int inf=1e18+5;
const int mod=1e9+7;

int dp[N][2];

main ()
{
    ios;
    string s;
    cin>>s;
    s='#'+s;
    for (int i=1;i<s.size();++i){
        if (s[i]!=s[i-1]){
            dp[i][0]=max(dp[i][0],dp[i-1][0]+1);
        }
        dp[i][0]=max(dp[i][0],dp[i-1][1]+1);
        if (i>1){
            dp[i][1]=max(dp[i][1],dp[i-2][0]+1);
            string p="";
            p+=s[i-3];
            p+=s[i-2];
            string p1="";
            p1+=s[i-1];
            p1+=s[i];
            if (p!=p1){
                dp[i][1]=max(dp[i][1],dp[i-2][1]+1);
            }
        }
    }
    int pos=s.size()-1;
    int ans=max(dp[pos][0],dp[pos][1]);
    cout<<ans<<endl;
}
