#include <bits/stdc++.h>
using namespace std;
char s[8001];
int pi[8001][8001];
int dp[8001];
void prefix_func(int num, char *s) {
  pi[num][0] = 0;
  for (int i = 1; s[i]; i++) {
    int k = pi[num][i - 1];
    while (s[i] != s[k] && k > 0) {
      k = pi[num][k - 1];
    }
    if (s[i] == s[k]) {
      k++;
    }
    pi[num][i] = k;
  }
}
int cnt10(int n) {
  int ans = 0;
  while (n > 0) {
    ans++;
    n /= 10;
  }
  return ans;
}
int main(int argc, const char *argv[]) {
  cin >> s;
  long n = strlen(s);
  for (int i = 0; i < n + 1; i++) {
    dp[i] = INT_MAX;
  }
  for (int i = 0; s[i]; i++) {
    prefix_func(i, s + i);
  }
  dp[0] = 0;
  for (int i = 0; i <= n; i++) {
    for (int j = i; s[j]; j++) {
      int len = j - i + 1;
      int pifun = pi[i][j - i];
      if (len % (len - pifun) == 0) {
        int c = len / (len - pifun);
        dp[j + 1] = min(dp[j + 1], dp[i] + cnt10(c) + len - pifun);
      } else {
        dp[j + 1] = min(dp[j + 1], dp[i] + 1 + len);
      }
    }
  }
  cout << dp[n];
  return 0;
}
