#include <bits/stdc++.h>
using namespace std;
const int MAXN = 256;
char input[256];
long long hashes[MAXN];
const int P = 1000000007;
long long powm(long long x, long long n) {
  long long ans = 1;
  for (; n; n /= 2) {
    if (n & 1) ans = ans * x;
    x = x * x;
  }
  return ans;
}
int main() {
  while (scanf("%s", input) == 1) {
    int lo, hi, mid;
    lo = 0;
    hi = strlen(input);
    int n = strlen(input);
    while (lo != hi) {
      mid = lo + (hi - lo + 1) / 2;
      long long Pn = powm(P, mid);
      hashes[mid] = 0;
      for (int n_ = (mid), i = 0; i < n_; ++i)
        hashes[mid] = hashes[mid] * P + input[i];
      for (int i = mid; i < n; ++i) {
        hashes[i + 1] = hashes[i] * P - input[i - mid] * Pn + input[i];
      }
      sort(hashes + mid, hashes + n + 1);
      bool found = false;
      if (unique(hashes + mid, hashes + n + 1) - hashes != n + 1) found = true;
      if (found) {
        lo = mid;
      } else {
        hi = mid - 1;
      }
    }
    printf("%d\n", lo);
  }
  return 0;
}
