#include <bits/stdc++.h>
using namespace std;
void in(int& r) {
  static char c;
  r = 0;
  while (c = getchar(), c < 48)
    ;
  do r = (r << 1) + (r << 3) + (c ^ 48);
  while (c = getchar(), c > 47);
}
const int mn = 8005;
int f[mn][mn], dp[mn];
char as[mn];
void fail(char* p, int* f, int len) {
  f[0] = -1;
  int now = -1;
  for (int q(1), q_end_(len - 1); q <= q_end_; ++q) {
    while (now != -1 && p[now + 1] != p[q]) now = f[now];
    if (p[now + 1] == p[q]) ++now;
    f[q] = now;
  }
}
int st[mn];
int main() {
  scanf("%s", as);
  int len = strlen(as);
  for (int q(0), q_end_(len - 1); q <= q_end_; ++q)
    fail(as + q, f[q] + q, len - q);
  st[0] = 0;
  for (int q(1), q_end_(len); q <= q_end_; ++q)
    st[q] = st[q / 10] + 1, dp[q] = 1e9;
  for (int q(0), q_end_(len - 1); q <= q_end_; ++q) {
    int* p = f[q];
    for (int w(q), w_end_(len - 1); w <= w_end_; ++w) {
      int le = w - q - p[w];
      if ((w - q + 1) % le == 0) {
        dp[w + 1] = min(dp[w + 1], dp[q] + le + st[(w - q + 1) / le]);
      } else
        dp[w + 1] = min(dp[w + 1], dp[q] + w - q + 2);
    }
  }
  printf("%d\n", dp[len]);
  return 0 ^ 0;
}
