#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
const long double PI = acos((long double)-1);
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % MOD;
    n = n * n % MOD;
  }
  return r;
}
const int base = 311;
const int N = 2e5 + 5;
long long m, n, x, y, k, q, ans;
string a[N];
void Solve() {
  string s;
  cin >> s;
  n = int((s).size());
  string v = "";
  k = 0;
  a[0] = s[0];
  for (int i = 1; i < n; i++) {
    v += s[i];
    if (v != a[k]) {
      k++;
      a[k] = v;
      v = "";
    }
  }
  if (v != "") k++;
  while (v == a[k - 1]) {
    v = a[k - 1] + v;
    k--;
  }
  reverse(s.begin(), s.end());
  v = "";
  m = 0;
  a[0] = s[0];
  for (int i = 1; i < n; i++) {
    v += s[i];
    if (v != a[m]) {
      m++;
      a[m] = v;
      v = "";
    }
  }
  if (v != "") m++;
  while (v == a[m - 1]) {
    v = a[m - 1] + v;
    m--;
  }
  cout << max(m, k) + 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Solve();
  return 0;
}
