#include <bits/stdc++.h>
using namespace std;
const int N = 8005;
char str[N], s[N];
int n, nxt[N], dp[N];
int main() {
  memset(dp, 63, sizeof(dp));
  scanf("%s", str), n = strlen(str);
  for (int k = 0; k < n; k++) {
    for (int j = k; j < n; j++) s[j - k] = str[j];
    int i = 0, j = -1;
    nxt[0] = -1;
    while (i <= n - k) {
      while (j != -1 && s[i] != s[j]) j = nxt[j];
      nxt[++i] = ++j;
    }
    for (int i = k; i < n; i++) {
      int now = (i - k + 1) - nxt[i - k + 1], res, cnt = 0;
      res = (i - k + 1) % now == 0 ? (i - k + 1) / now : 1;
      if (res == 1) {
        if (k == 0)
          dp[i] = min(dp[i], i - k + 2);
        else
          dp[i] = min(dp[i], dp[k - 1] + i - k + 2);
      } else {
        int NOW = res;
        while (NOW) NOW /= 10, cnt++;
        if (k == 0)
          dp[i] = min(dp[i], now + cnt);
        else
          dp[i] = min(dp[i], dp[k - 1] + now + cnt);
      }
    }
  }
  printf("%d\n", dp[n - 1]);
  return 0;
}
