#include <bits/stdc++.h>
using namespace std;
int division_counts[2 * 100000 + 10][2] = {{}};
int main(void) {
  string str;
  cin >> str;
  division_counts[0][0] = 1;
  division_counts[0][1] = 1;
  if (str[0] == str[1]) {
    division_counts[2][1] = 2;
  } else {
    division_counts[1][0] = 2;
  }
  for (int i = 2; i < str.size(); i++) {
    if (str[i] == str[i - 1]) {
      division_counts[i][0] = division_counts[i - 1][1] + 1;
      division_counts[i][1] = division_counts[i - 2][0] + 1;
    } else {
      division_counts[i][0] =
          max(division_counts[i - 1][0], division_counts[i - 1][1]) + 1;
      division_counts[i][1] =
          max(division_counts[i - 2][0], division_counts[i - 2][1]) + 1;
    }
  }
  int end_index = str.size() - 1;
  cout << max(division_counts[end_index][0], division_counts[end_index][1])
       << endl;
  return 0;
}
