#include <bits/stdc++.h>
using namespace std;
void NITRO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int MAX_N = 360;
void solve() {
  string word;
  int ma = 0;
  cin >> word;
  for (int i = 0; i < word.size() - 1; i++) {
    string pre = "";
    for (int o = i; o < word.size(); o++) {
      pre += word[o];
      if (word.find(pre, i + 1) == string::npos)
        break;
      else
        ma = max(ma, o - i + 1);
    }
  }
  cout << ma;
}
int main() {
  NITRO();
  solve();
  return 0;
}
