#include <bits/stdc++.h>
using namespace std;
int dp[10000];
struct simplehash {
  int len;
  long long base, mod;
  vector<int> P, H, R;
  simplehash() {}
  simplehash(const char* str, long long b, long long m) {
    base = b, mod = m, len = strlen(str);
    P.resize(len + 3, 1), H.resize(len + 3, 0), R.resize(len + 3, 0);
    for (int i = 1; i <= len; i++) P[i] = (P[i - 1] * base) % mod;
    for (int i = 1; i <= len; i++)
      H[i] = (H[i - 1] * base + str[i - 1] + 1007) % mod;
    for (int i = len; i >= 1; i--)
      R[i] = (R[i + 1] * base + str[i - 1] + 1007) % mod;
  }
  inline int range_hash(int l, int r) {
    int hashval = H[r + 1] - ((long long)P[r - l + 1] * H[l] % mod);
    return (hashval < 0 ? hashval + mod : hashval);
  }
  inline int reverse_hash(int l, int r) {
    ;
    int hashval = R[l + 1] - ((long long)P[r - l + 1] * R[r + 2] % mod);
    return (hashval < 0 ? hashval + mod : hashval);
  }
};
struct stringhash {
  simplehash sh1, sh2;
  stringhash() {}
  stringhash(const char* str) {
    sh1 = simplehash(str, 1949313259, 2091573227);
    sh2 = simplehash(str, 1997293877, 2117566807);
  }
  inline long long range_hash(int l, int r) {
    return ((long long)sh1.range_hash(l, r) << 32) ^ sh2.range_hash(l, r);
  }
  inline long long reverse_hash(int l, int r) {
    return ((long long)sh1.reverse_hash(l, r) << 32) ^ sh2.reverse_hash(l, r);
  }
} S;
char str[1000005];
int dig[10000], help[8002][8002];
int total_digit(int num) {
  int cnt = 0;
  while (num != 0) {
    num = num / 10;
    cnt++;
  }
  return cnt;
}
int main() {
  int i, len, j, sz, l, r, p1, p2, p3, p4, pos, k;
  for (i = 0; i < 10000; i++) dig[i] = total_digit(i);
  scanf("%s", str);
  len = strlen(str);
  S = stringhash(str);
  for (i = len - 1; i >= 0; i--) {
    for (j = 1; j <= len; j++) {
      p1 = i;
      p2 = p1 + j - 1;
      p3 = p2 + 1;
      p4 = p3 + j - 1;
      help[i][j] = 1;
      if (p4 >= len) continue;
      if (S.range_hash(p1, p2) == S.range_hash(p3, p4)) {
        help[i][j] = help[p3][j] + 1;
      }
    }
  }
  for (i = 0; i <= len; i++) dp[i] = 1e8;
  for (i = 0; i < len; i++) {
    for (j = 1; j <= len; j++) {
      for (k = 1; k <= help[i][j]; k++) {
        pos = i + j * k - 1;
        if (pos >= len) break;
        if (i - 1 < 0) {
          dp[pos] = min(dp[pos], j + dig[k]);
        } else {
          dp[pos] = min(dp[pos], dp[i - 1] + j + dig[k]);
        }
      }
    }
  }
  cout << dp[len - 1] << endl;
}
