#include <bits/stdc++.h>
using namespace std;
vector<vector<long long int>> cn(long long int n, long long int m) {
  return vector<vector<long long int>>(n, vector<long long int>(m));
}
bool compare(char &s1, char &s2) { return s1 > s2; }
bool sortmahstyle(const pair<long long int, long long int> &a,
                  const pair<long long int, long long int> &b) {
  if (a.first < b.first) return true;
  if (a.first == b.first && a.second != b.second) return true;
  return false;
}
bool cmp(int n, pair<int, int> const &p) { return (p.first < n); }
long long int const mod = 1e9 + 7;
long long int const inf = 1e18;
long long int const maxn = 2e5 + 1;
int stoint(string s) {
  int n = s.size();
  int num = 0;
  for (long long int i = 0; i < n; i++) {
    num = num * 10 + (int)(s[i] - '0');
  }
  return num;
}
void solve() {
  string s;
  cin >> s;
  long long int n = s.size();
  long long int dp[n][2];
  dp[0][0] = 0, dp[0][1] = 0;
  dp[1][0] = 1, dp[0][1] = 0;
  for (long long int i = 2; i < n; i++) {
    if (s[i] == s[i - 1]) {
      dp[i][0] = dp[i - 1][1] + 1;
      dp[i][1] = dp[i - 2][0] + 1;
    } else {
      dp[i][0] = dp[i - 1][0] + 1;
      dp[i][1] = dp[i - 2][0] + 1;
    }
  }
  cout << max(dp[n - 1][0], dp[n - 1][1]) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  for (long long int testcases = 0; testcases < t; testcases++) {
    solve();
  }
  return 0;
}
