#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
const int MAX = 8000 + 3;
string s;
int pi[MAX][MAX];
void prefixFunction(int st) {
  int n = (int)s.size();
  for (int i = (1); i < (n - st); i++) {
    int j = pi[st][i - 1];
    while (j != 0 && s[st + j] != s[st + i]) {
      j = pi[st][j - 1];
    }
    if (s[st + i] == s[st + j]) j++;
    pi[st][i] = j;
  }
}
int dp[MAX];
int getLen(int n) {
  int res = 0;
  while (n != 0) {
    res++;
    n /= 10;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  int n = (int)s.size();
  for (int i = (0); i < (n); i++) {
    prefixFunction(i);
  }
  for (int i = (n)-1; i >= (0); i--) {
    dp[i] = INF;
    for (int j = (i); j < (n); j++) {
      int len = j - i + 1, period = len;
      if (len % (len - pi[i][j - i]) == 0) {
        period = len - pi[i][j - i];
      }
      dp[i] = min(dp[i], period + getLen(len / period) + dp[j + 1]);
    }
  }
  cout << dp[0] << endl;
  return 0;
}
