#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c = ' ') {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cerr << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T* val) {
  cerr << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cerr << val;
}
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
  __evars_out_var(a);
  cerr << "; ";
  __evars(++it, args...);
}
const int mod = 1000000007;
const int N = 2e5 + 10;
const int M = 5e3 + 15;
void mina(int& a, int b) {
  if (a > b) a = b;
}
int calc[8008][8008];
int nd[8008];
void caaar() {
  for (int i = 1; i < 8008; ++i) {
    int t = i;
    while (t > 0) {
      t = t / 10;
      nd[i]++;
    }
  }
  string s;
  cin >> s;
  int n = s.length();
  bool f = true;
  for (int i = 1; i < n; ++i) {
    if (s[i] != s[0]) f = false;
  }
  if (f) {
    cout << nd[n] + 1;
    return;
  }
  for (int j = 0; j < n; ++j) {
    vector<int> z(n);
    for (int i = j + 1, l = j, r = j; i < n; ++i) {
      if (i <= r) z[i] = min(r - i + 1, z[i - l + j]);
      while (i + z[i] < n && s[j + z[i]] == s[i + z[i]]) ++z[i];
      if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
    }
    for (int i = j; i < n; ++i) calc[j][i] = i - j + 2;
    for (int i = j + 1; i < n; ++i) {
      int l = i - j, t, cmp = z[i] + i - j, c = 2;
      t = 2 * l;
      while (t <= n - j) {
        if (cmp >= t) mina(calc[j][j + t - 1], l + nd[c]);
        t += l;
        c++;
      }
    }
  }
  vector<int> dp(n + 1, n + 10);
  dp[0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) mina(dp[i], dp[j] + calc[j][i - 1]);
  }
  cout << dp[n];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc = 1;
  for (int i = 1; i <= tc; ++i) {
    caaar();
    if (i < tc) cout << "\n";
  }
  return 0;
}
