/*
	author : SAMRAT DE
	username : Alucard_01
	NIT Durgapur
*/

/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>*/
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define vec(x) vector<x> 
#define st(x) set<x> 
#define pi(x,y) pair<x,y>
#define mpp(x,y) map<x,y>
#define pqq(x) priority_queue<x> 
#define min_heap(x) priority_queue<x, vector<x>, greater<x> >
#define all(x) x.begin(),x.end()
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(ll i=x-1;i>=y;i--)
#define rev(x) reverse(x.begin(),x.end())
#define mem(x,a) memset(x,a,sizeof(x))
#define mod 1000000007
#define nxt_per(x) next_permutation(x.begin(),x.end())
#define pb push_back
#define pf push_front
#define indexof order_of_key
#define valueat find_by_order
#define myds tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> 

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dxx[8]={0,0,1,-1,-1,-1,1,1};
int dyy[8]={1,-1,0,0,-1,1,1,-1};

using namespace std;
//using namespace __gnu_pbds;

int32_t main()
{
	fastio;
	//best of luck don't loose hope man	
		
	string s;cin>>s;
	int dp[s.size()];
	mem(dp,1);
	if(s[0]==s[1])
		dp[1]=1;
	else
		dp[1]=2;
	if(s[2]==s[1])
		dp[2]=2;
	else
		dp[2]=dp[1]+1;
	rep(i,3,n){
		if(s[i]==s[i-1])
			dp[i]=d[i-3]+2;
		else
			dp[i]=dp[i-1]+1;
	}
	cout<<dp[n-1]<<endl;
	return 0;
}