#include <bits/stdc++.h>
using namespace std;
char s[8005];
int len, f[8005];
int dp[8005], cnt[8005][8005];
int WEI(int x) {
  int d = 0;
  while (x) d++, x /= 10;
  return d;
}
int main() {
  scanf("%s", s + 1);
  len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    memset(f, 0, sizeof(f));
    f[i] = f[i + 1] = i;
    cnt[i][i] = 2;
    for (int j = i + 1; j <= len; j++) {
      int t = f[j];
      while (t > i && s[t] != s[j]) t = f[t];
      if (s[t] == s[j]) t++;
      f[j + 1] = t;
      int l = j - i + 1;
      cnt[i][j] = l % (j - f[j + 1] + 1) == 0
                      ? (j - f[j + 1] + 1) + WEI(l / (j - f[j + 1] + 1))
                      : l + 1;
    }
  }
  memset(dp, 127, sizeof(dp));
  dp[0] = 0;
  for (int i = 1; i <= len; i++)
    for (int j = 0; j < i; j++) dp[i] = min(dp[i], dp[j] + cnt[j + 1][i]);
  printf("%d\n", dp[len]);
  return 0;
}
