#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    string S;
    cin >> S;
    long long  N = S.size();
    int i = 0
    long long  count = N;
    while (i < N - 3)
    {
        if (S[i] == S[i + 1])
        {
            count--;
            i += 3;
            if (i > N - 2)
            {
                count++;
            }
        }
        else
        {
            i++;
        }
    }
    if (S[N - 2] == S[N - 1])
    {
        count--;
    }
    cout << count << endl;
}