#include <bits/stdc++.h>
using namespace std;
map<string, int> count_;
string s;
int main() {
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    for (int j = i; j < s.length(); j++) {
      int l = j - i + 1;
      string u = s.substr(i, l);
      count_[u]++;
    }
  }
  int res = 0;
  for (map<string, int>::iterator it = count_.begin(); it != count_.end();
       it++) {
    if (it->second >= 2) {
      res = max(res, (int)it->first.length());
    }
  }
  cout << res << endl;
}
