#include <bits/stdc++.h>
using namespace std;
int len, cnt[8010], f[8010], nxt[8010];
char st[8010];
void kmp(char *st, int len, int nxt[]) {
  nxt[0] = nxt[1] = 0;
  for (int i = 1; i < len; i++) {
    int j = nxt[i];
    while (j && st[i] != st[j]) {
      j = nxt[j];
    }
    nxt[i + 1] = st[j] == st[i] ? j + 1 : 0;
  }
}
int main() {
  cin >> st;
  len = strlen(st);
  for (int i = 1; i <= len; i++) {
    cnt[i] = cnt[i / 10] + 1, f[i] = i + 1;
  }
  for (int i = 0; i < len; i++) {
    kmp(st + i, len - i, nxt);
    for (int j = 1; j + i <= len; j++) {
      if (j % (j - nxt[j]) == 0) {
        f[j + i] = min(f[j + i], f[i] + cnt[j / (j - nxt[j])] + (j - nxt[j]));
      } else {
        f[j + i] = min(f[j + i], f[i] + 1 + j);
      }
    }
  }
  cout << f[len];
  return 0;
}
