#include <bits/stdc++.h>
using namespace std;
char s[8010];
int Next[8010], dp[8010];
int Check(int x) {
  int js = 0;
  while (x > 0) {
    js++;
    x /= 10;
  }
  return js;
}
int main() {
  scanf("%s", s);
  int l = strlen(s);
  for (int i = l; i >= 1; i--) {
    s[i] = s[i - 1];
    dp[i] = 2147483647;
  }
  dp[0] = 0;
  int k, x;
  for (int i = 1; i <= l; i++) {
    Next[i] = i - 1;
    x = dp[i - 1];
    k = i - 1;
    dp[i] = min(x + 2, dp[i]);
    for (int j = i + 1; j <= l; j++) {
      while (s[k + 1] != s[j]) {
        if (k == i - 1) break;
        k = Next[k];
      }
      if (s[k + 1] == s[j])
        Next[j] = ++k;
      else
        Next[j] = i - 1;
      if (Next[j] == i - 1 || (Next[j] - i + 1) * 2 < j - i + 1 ||
          (j - i + 1) % (j - Next[j]) != 0) {
        dp[j] = min(dp[j], x + j - i + 2);
      } else {
        dp[j] =
            min(dp[j], x + Check((j - i + 1) / (j - Next[j])) + j - Next[j]);
      }
    }
  }
  printf("%d", dp[l]);
  return 0;
}
