#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
int dp[100005][2];
void Main() {
  string s;
  cin >> s;
  int n = s.size();
  if (n == 1) {
    cout << 1 << endl;
    return;
  } else {
    if (s[0] == s[1]) {
      dp[0][0] = 1;
      dp[0][1] = 0;
      dp[1][0] = 1;
      dp[1][1] = 1;
    } else {
      dp[0][0] = 1;
      dp[0][1] = 0;
      dp[1][0] = 2;
      dp[1][1] = 1;
    }
  }
  for (ll i = 2; i < (ll)(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() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
