#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve1.txt","w",stdout)
#define int long long
using namespace std;

typedef long long ll;

int solve(string s,bool f){
    int res = 1;
    if(s.size() == 1)return 1;
    for(int i(f+1); i < s.size();i++){
        if(!f){
            if(i && s[i] == s[i-1]){
                if(i+2>=s.size())return 0;
                f = !f;
                res++;i++;
            }else{
                res++;
                continue;
            }
        }
        else{
            res++;
            f = !f;
        }
    }
    return res;
}

main()
{
    ios_base::sync_with_stdio(0);
    string s; cin >> s;
    cout << max(solve(s,0),solve(s,1));
    return 0;
}
/*
*/

