#include <bits/stdc++.h>
using namespace std;
template <class T>
void splitstr(const string &s, vector<T> &out) {
  istringstream in(s);
  out.clear();
  copy(istream_iterator<T>(in), istream_iterator<T>(), back_inserter(out));
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
static void redirect(int argc, const char **argv) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (argc > 1) {
    static filebuf f;
    f.open(argv[1], ios::in);
    cin.rdbuf(&f);
    if (!cin) {
      cerr << "Failed to open '" << argv[1] << "'" << endl;
      exit(1);
    }
  }
  if (argc > 2) {
    static filebuf f;
    f.open(argv[2], ios::out | ios::trunc);
    cout.rdbuf(&f);
    if (!cout) {
      cerr << "Failed to open '" << argv[2] << "'" << endl;
    }
  }
}
int main(int argc, const char **argv) {
  redirect(argc, argv);
  string s;
  cin >> s;
  int L = ((long long)(s).size());
  vector<int> digits(10000, 1);
  fill(digits.begin() + 10, digits.begin() + 100, 2);
  fill(digits.begin() + 100, digits.begin() + 1000, 3);
  fill(digits.begin() + 1000, digits.begin() + 10000, 4);
  vector<int> dp(L + 1);
  dp[L] = 0;
  vector<int> repe(L + 1, L);
  for (int i = L - 1; i >= 0; i--) {
    int v = INT_MAX;
    for (int j = 1; j <= L - i; j++) {
      if (i + j < repe[j] && s[i + j] != s[i]) repe[j] = i + j;
      for (int r = 1; i + r * j <= repe[j]; r++)
        v = min(v, digits[r] + j + dp[i + r * j]);
    }
    dp[i] = v;
  }
  cout << dp[0] << '\n';
  return 0;
}
