#include <bits/stdc++.h>
using namespace std;

int main(){
	string s;
	cin >> s;
	long long int num = s.size();
	long long int count = 0;
	long long int i=0;
	while(i<num-1){
		if(s.at(i) == s.at(i+1)){
			count++;
			i += 3;
		}else{
			i++;
		}
	}
	cout << num-count << endl;
	return 0;
}