#include <bits/stdc++.h>
using namespace std;
int len, n, dp[10010], cost[8010][8010], kmp[10010], lenth[10010];
char S[10010], A[10010];
int main() {
  for (int i = 1; i <= 10000; i++) {
    int x = i;
    while (x) {
      lenth[i]++;
      x /= 10;
    }
  }
  scanf("%s", S + 1);
  memset(dp, 63, sizeof(dp));
  dp[0] = 0;
  n = strlen(S + 1);
  for (int i = 1; i <= n; i++) {
    len = 0;
    for (int j = i; j <= n; j++) A[len++] = S[j];
    kmp[0] = -1;
    for (int j = 1, k = -1; j <= len; j++) {
      while (k != -1 && A[j - 1] != A[k]) k = kmp[k];
      k++;
      kmp[j] = k;
    }
    for (int j = 1; j <= len; j++) {
      if (kmp[j] != 0 && (j % (j - kmp[j])) == 0) {
        cost[i][i + j - 1] = (j - kmp[j]) + lenth[j / (j - kmp[j])];
      } else
        cost[i][i + j - 1] = j + 1;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= i; j++) {
      dp[i] = min(dp[i], dp[j - 1] + cost[j][i]);
    }
  }
  cout << dp[n];
  return 0;
}
