#include <bits/stdc++.h>
std::istream& operator>>(std::istream& input, __int128_t& value) {
  int64_t tmp;
  input >> tmp;
  value = tmp;
  return input;
}
std::ostream& operator<<(std::ostream& output, const __int128_t value) {
  output << (int64_t)value;
  return output;
}
__int128_t imax(const __int128_t a, const __int128_t b) {
  return std::max(a, b);
}
__int128_t imin(const __int128_t a, const __int128_t b) {
  return std::min(a, b);
}
std::vector<int> irange(const int begin, const int end) {
  std::vector<int> ret;
  for (int i = begin; i <= end; i++) {
    ret.push_back(i);
  }
  return ret;
}
template <typename T>
void printvec(const std::vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++) {
    std::cout << vec[i] << " ";
  }
  std::cout << std::endl;
}
std::string S;
const int MAX_N = 2e5 + 10;
int dp[MAX_N][3] = {};
int main(int argc, char** argv) {
  std::cin >> S;
  if (S.size() == 1) {
    std::cout << 1 << std::endl;
    return 0;
  }
  if (S.size() == 2) {
    if (S[1] == S[0]) {
      std::cout << 1 << std::endl;
    } else {
      std::cout << 2 << std::endl;
    }
    return 0;
  }
  if (S[0] == S[1]) {
    dp[1][2] = 1;
  } else {
    dp[1][1] = 2;
    dp[1][2] = 1;
  }
  for (int64_t i = ((int64_t)2); i <= ((int64_t)S.size() - 1); i++) {
    if (dp[i - 1][2]) {
      dp[i][1] = dp[i - 1][2] + 1;
    }
    if (S[i] != S[i - 1]) {
      if (dp[i - 1][1]) {
        dp[i][1] = imax(dp[i][1], dp[i - 1][1] + 1);
      }
    }
    if (2 <= i && dp[i - 2][1]) {
      dp[i][2] = dp[i - 2][1] + 1;
    }
  }
  std::cout << imax(dp[S.size() - 1][1], dp[S.size() - 1][2]) << std::endl;
  return 0;
}
