//#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
int main() {
	string s;
	cin >> s;
	int ans = 0, flag = 0;
	for (int i = 0; i < s.length() - 1; i++) {
		if (s[i] != s[i + 1] || flag == 1) {
			flag = 0;
		}
		else {
			i++;
			flag = 1;
		}
		ans++;
	}
	if (flag == 0)
		ans++;
	if (s.length() >= 3) {
		if (s[s.length() - 3] == s[s.length() - 2] && s[s.length() - 2] == s[s.length() - 1])
			ans++;
	}
	cout << ans;
}