#include <bits/stdc++.h>
using namespace std;
int solve(const string& s) {
  int max_ = 0;
  unordered_set<size_t> done;
  vector<vector<pair<size_t, size_t>>> dp(s.size() + 1);
  for (size_t i = 0; i < s.size(); ++i) {
    for (size_t j = dp.size() - 1; j != size_t(-1); --j) {
      done.clear();
      for (auto&& p : dp[j]) {
        auto begin = p.first;
        auto end = p.second;
        if (done.count(end) == 0) {
          bool ok = true;
          if (end - begin == i - end) {
            for (size_t xx = 0; xx < end - begin; ++xx) {
              if (s[begin + xx] != s[end + xx]) {
                ok = false;
                break;
              }
            }
          }
          if (ok) {
            max_ = max(max_, int(j));
            dp[j + 1].emplace_back(end, i);
            done.emplace(end);
          }
        }
      }
    }
    dp[0].emplace_back(0, i + 1);
  }
  return max_ + 1;
}
int main() {
  string s;
  cin >> s;
  cout << solve(s) << endl;
}
