#include <bits/stdc++.h>
char S[200000];
int slen;
struct str {
  int start;
  int end;
};
int div_str(struct str);
int main(int argc, char *argv[]) {
  int sr;
  int a, b;
  int i, j;
  int dn, dmax = 1;
  struct str fs;
  sr = scanf("%s", S);
  slen = strlen(S);
  fs.start = 0;
  for (i = 0; slen - i > dmax; i++) {
    fs.end = i;
    dn = div_str(fs);
    if (dn > dmax) dmax = dn;
  }
  printf("%d\n", dmax);
  fflush(stdout);
  return 0;
}
int eqs(struct str a, struct str b) {
  int i;
  int d = b.start - a.start;
  for (i = a.start; i <= a.end; i++) {
    if (S[i] != S[i + d]) return 0;
  }
  return 1;
}
int div_str(struct str fs) {
  int i;
  int dn, dmax = 0;
  int dl;
  struct str fn;
  dl = fs.end - fs.start;
  fn.start = fs.end + 1;
  for (fn.end = fn.start; slen - fn.end > dmax; fn.end++) {
    if (fn.end - fn.start == dl && eqs(fs, fn)) continue;
    dn = div_str(fn);
    if (dn > dmax) dmax = dn;
  }
  return dmax + 1;
}
