#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const double PI = acos(-1.0);
const int MAXN = 8005;
const int MAXM = 2e6 + 5;
const int MOD = 1e9 + 7;
int sgn(double x) {
  if (fabs(x) < eps) return 0;
  if (x < 0)
    return -1;
  else
    return 1;
}
long long pw(long long a, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void inc(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
void dec(long long &a, long long b) {
  a -= b;
  if (a < 0) a += MOD;
}
int mul(int a, int b) {
  long long c = 1ll * a * b;
  return c - c / MOD * MOD;
}
int n;
char s[MAXN];
int nxt[MAXN], dp[MAXN], cost[MAXN];
int get(int x) {
  int ret = 0;
  while (x) {
    ret++;
    x /= 10;
  }
  return ret;
}
void getnxt(int j) {
  nxt[j] = j;
  cost[j] = 2;
  for (int i = j + 1, k = j; i <= n; i++) {
    while (k > j && s[i] != s[k]) k = nxt[k - 1];
    if (s[i] == s[k]) k++;
    nxt[i] = k;
    int l = (i - j + 1), m = i - nxt[i] + 1;
    if (l % m == 0)
      cost[i] = get(l / m) + m;
    else
      cost[i] = l + 1;
  }
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  memset(dp, INF, sizeof(dp));
  dp[0] = 0;
  for (int j = 1; j < n + 1; j++) {
    getnxt(j);
    for (int i = j; i < n + 1; i++) {
      dp[i] = min(dp[i], dp[j - 1] + cost[i]);
    }
  }
  printf("%d\n", dp[n]);
}
