#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[102];
  char b[101];
  cin >> a;
  int len;
  for (len = 0; a[len]; len++)
    ;
  int i, j, jj;
  bool flag;
  int n = len;
  len--;
  int count;
  while (len > 0) {
    for (i = 0; i < n - len; i++) {
      for (j = i; j < i + len; j++) b[j] = a[j];
      count = 0;
      for (j = 0; j <= n - len; j++) {
        flag = true;
        for (jj = 0; jj < len; jj++)
          if (a[j + jj] != b[i + jj]) flag = false;
        if (flag && jj == len) count++;
      }
      if (count > 1) break;
    }
    if (count > 1) break;
    len--;
  }
  cout << len << endl;
  return 0;
}
