#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
string S;
cin >> S;
int c = 1;
for(int i  =1 ;i<S.size();i++){
if(S[i] == S[i-1]){
    i+=2;
    c+=2;
    if(i+1 - S.size() == 1) c--;
    if(i+1 -S.size() == 2 ) c -= 2;
}
else if(S[i] != S[i-1]){
    c++;
}
}
cout << c << endl;
}