#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
char s[N];
int n, f[N], nxt[N];
void kmp(int x) {
  for (int i = 0; i <= x; i++) nxt[i] = x - 1;
  for (int i = x + 1, j = x - 1; i <= n; i++) {
    while (j > x - 1 && s[j + 1] != s[i]) j = nxt[j];
    if (s[j + 1] == s[i]) j++;
    nxt[i] = j;
  }
}
int shu[110000];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= 21000; i++) {
    int pp = i;
    while (pp) shu[i]++, pp /= 10;
  }
  memset(f, 0x3f, sizeof(f));
  f[0] = 0;
  for (int i = 1; i <= n; i++) {
    kmp(i);
    for (int j = 0; j <= n; j++) nxt[j] -= i - 1;
    for (int j = i; j <= n; j++) {
      int len = j - i + 1;
      int tmp;
      if (len % (len - nxt[j]) == 0)
        tmp = shu[len / (len - nxt[j])] + len - nxt[j];
      else
        tmp = len + 1;
      f[j] = min(f[j], f[i - 1] + tmp);
    }
  }
  cout << f[n] << endl;
}
