// only log(n) new edges???
#include<bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second 
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define int long long
#define forn(i, x, y) for(int i = x; i <= y; i++)
#define forev(i, y, x) for(int i = y; i >= x; i--)

using namespace std;

const int maxn = (int)3e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
const int inf = (int)1e9 + 7;

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double ld;

using namespace std;

int n, h[maxn], pw[maxn], dp[maxn], prv[maxn];
int get(int l, int r){
  return (h[r] - (pw[r - l + 1] * h[l - 1]) % mod + mod) % mod;
}
string s;
main () {
  cin >> s;
  n = sz(s);
  s = '$' + s;
  pw[0] = 1;
  forn(i, 1, n){
    pw[i] = pw[i - 1] * 1ll * P % mod;
    h[i] = (h[i - 1] * 1ll * P % mod + s[i]) % mod;
  }
  dp[1] = 1, prv[1] = 1;
  forn(i, 2, n){
    dp[i] = 1, prv[i] = 1;
    forn(j, 2, i){
      if(get(j, i) != get(prv[j - 1], j - 1)){
        if(dp[i] < dp[j - 1] + 1){
          dp[i] = dp[j - 1] + 1;
          prv[i] = j;
        }
      }
    }
  }
  cout << dp[n];
}