#include <bits/stdc++.h>
using namespace std;
const int vx[4] = {0, 1, 0, -1};
const int vy[4] = {1, 0, -1, 0};
string s;
long long dp[200100];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> s;
  for (long long i = (long long)0; i < (long long)s.size(); i++) {
    dp[i + 3] = max(dp[i + 3], dp[i] + 2);
    for (long long j = (long long)1; j < (long long)3; j++) {
      if (i + 2 * j <= s.size() && s.substr(i, j) != s.substr(i + j, j))
        dp[i + 2 * j] = max(dp[i + 2 * j], dp[i] + 2);
    }
  }
  cout << dp[s.size()] << endl;
}
