#include <bits/stdc++.h>
using namespace std;
const int CN = 2e5 + 5;
char ch[CN];
int n;
bool exm(int cl, int cr, int pl, int pr) {
  if ((pr - pl + 1) != (cr - cl + 1)) return true;
  for (int i = 0; i < (pr - pl + 1); i++)
    if (ch[cl + i] != ch[pl + i]) return true;
  return false;
}
bool dfs(int st, int rst, int pl, int pr) {
  if (!rst) return exm(st, n, pl, pr);
  for (int k = st; k <= n - rst + 1; k++)
    if (exm(st, k, pl, pr) && dfs(k + 1, rst - 1, st, k)) return true;
  return false;
}
int main() {
  cin >> ch;
  n = strlen(ch) - 1;
  int l = 1, r = n, mid;
  while (l < r) {
    mid = (l + r + 1) >> 1;
    if (dfs(0, mid, 1, 0))
      l = mid;
    else
      r = mid - 1;
  }
  printf("%d", l);
  return 0;
}
