// Remember...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int maxn=2e5+10,mod=1e9+7;
const ll inf=1e18;

int dp[maxn][3];
string s;

bool ok(int st,int x,int y){
    if(x!=y) return 1;
    for(int i=0;i<x;i++)
	if(s[st+i] != s[st+x+i]) return 1;
    return 0;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();

    cin>>s;
    int n=sz(s);
    for(int i=0;i<n;i++){
	for(int j=1;j<=3;j++){
	    dp[i+1][j-1]=1;
	    for(int k=1;k<=3;k++){
		if(j+k>i+1) continue;
		if(ok(i+1-j-k,j,k)) dp[i+1][j-1]= max(dp[i+1][j-1], dp[i+1-j][k-1]+1);
			       
	    }
	}
    }   
    return cout<<max(dp[n][0], max(dp[n][1],dp[n][2]) )<<endl,0;
}
// Deathly mistakes:
//  * Read the problem carefully.
//  * Check maxn.
//  * Overflows.


// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
