#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
bool Max(T1& a, T2 b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T1, typename T2>
bool Min(T1& a, T2 b) {
  return a > b ? a = b, 1 : 0;
}
const int N = 10001;
string s;
int n;
int len[N];
int f[N];
void solve() {
  cin >> s;
  n = s.size();
  for (int i = 1; i <= (n); ++i) len[i] = 1 + len[i / 10], f[i] = n + 1;
  for (int i = 0; i < (n); ++i) {
    vector<int> pre(n - i);
    int cur = 0;
    for (int j = i + 1; j <= (n - 1); ++j) {
      while (cur && s[i + cur] != s[j]) cur = pre[cur - 1];
      if (s[i + cur] == s[j]) cur++;
      pre[j - i] = cur;
    }
    for (int j = i + 1; j <= (n); ++j) {
      int p = pre[j - i - 1];
      int l = j - i;
      if (l % (l - p) == 0) l -= p;
      Min(f[j], f[i] + len[(j - i) / l] + l);
    }
  }
  cout << f[n] << '\n';
}
void init() {}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  init();
  int TC = 1;
  for (int TI = 1; TI <= (TC); ++TI) {
    solve();
  }
  return 0;
}
