#include <bits/stdc++.h>
using namespace std;
const int N = 8e3 + 5;
const int INF = 1e9 + 7;
int dp[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  string str;
  cin >> str;
  int n = str.length();
  vector<int> lps(n);
  for (int i = n - 1; i >= 0; i--) {
    dp[i] = 2 + dp[i + 1];
    int len = 0;
    int j = 1;
    while (j < n - i) {
      if (str[i + j] == str[i + len]) {
        len++;
        lps[j] = len;
        j++;
      } else {
        if (len)
          len = lps[len - 1];
        else
          lps[j++] = 0;
      }
    }
    for (j = 0; j < n - i; j++) {
      int p = 1;
      if ((j + 1) % (j + 1 - lps[j]) == 0) {
        p = (j + 1) / (j + 1 - lps[j]);
      }
      int x = p, c = 0;
      while (x) {
        x /= 10;
        c++;
      }
      int ans = c + (j + 1) / p + dp[i + j + 1];
      dp[i] = min(dp[i], ans);
    }
  }
  cout << dp[0] << "\n";
  return 0;
}
