#include <bits/stdc++.h>
using namespace std;
char s[110];
int ans;
int f[110][110];
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  for (int i = len; i >= 1; i--) {
    for (int j = len; j >= 1; j--) {
      if (s[i] == s[j])
        f[i][j] = f[i + 1][j + 1] + 1;
      else
        f[i][j] = 0;
    }
  }
  for (int i = 1; i <= len; i++)
    for (int j = i + 1; j <= len; j++) ans = max(f[i][j], ans);
  cout << ans << endl;
  return 0;
}
