#include <bits/stdc++.h>

using namespace std;

#define int long long

const int INF = 1e9;

string S;

int f(int L) {
    int ans = 2*((L)/3);
    if (L%3 > 0) ans += 1;
    return ans;
}

main() {

    cin >> S;

    vector<vector<int>> dp(S.size(),vector<int>(2,-INF));

    dp[0][0] = 1;

    for (int i = 1; i < S.size(); i++) {
        dp[i][0] = dp[i-1][1] + 1;
        if (S[i] != S[i-1]) dp[i][0] = max(dp[i][0], dp[i-1][0] + 1);
        if (i > 1) dp[i][1] = dp[i-2][0] + 1;
        if (i > 3 && !(S[i] == S[i-2] && S[i-1] == S[i-3])) dp[i][1] = max(dp[i][1], dp[i-2][1] + 1);
    }

    cout << max(dp[S.size()-1][0],dp[S.size()-1][1]) << "\n";
    
}