#include <bits/stdc++.h>
using namespace std;
const int N = 8e3 + 2;
const int inf = 1e9 + 7;
int r[N], cnt[N], dp[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, i, j, k, l;
  string s;
  cin >> s;
  n = s.size();
  s = ' ' + s;
  for (i = 1; i <= 8000; i++) {
    j = i, k = 0;
    while (j) {
      k++;
      j /= 10;
    }
    cnt[i] = k;
    dp[i] = inf;
  }
  dp[0] = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; i + j - 1 <= n; j++) {
      k = i + j - 1;
      if (j > 1) {
        r[j] = r[j - 1];
        while (true) {
          if (s[i + r[j]] == s[k]) {
            r[j]++;
            break;
          }
          if (!r[j]) {
            break;
          }
          r[j] = r[r[j]];
        }
      } else {
        r[j] = 0;
      }
      if (r[j] && j % (j - r[j]) == 0) {
        dp[k] = min(dp[k], dp[i - 1] + cnt[j / (j - r[j])] + j - r[j]);
      }
      dp[k] = min(dp[k], dp[i - 1] + 1 + j);
    }
  }
  cout << dp[n];
}
