#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
char s[N];
int n, ans, f[N][2];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] - 'a' == s[i - 1] - 'a')
      f[i][0] = f[i - 1][1], f[i][1] = f[i - 1][0] + 1;
    else
      f[i][0] = max(f[i - 1][1], f[i - 1][0] + 1), f[i][1] = f[i - 1][0] + 1;
  }
  printf("%d\n", max(f[n][0], f[n][1]));
}
