#include <bits/stdc++.h>
using namespace std;
int n;
int f[8008];
int dp[8008];
string s;
void func() {
  for (int i = 0; i < n; i++) f[i] = 0;
  for (int i = 1; i < s.size(); i++) {
    int j = f[i - 1];
    while (j > 0 && s[i] != s[j]) j = f[j - 1];
    if (s[i] == s[j]) j++;
    f[i] = j;
  }
}
int calc(int x) {
  int res = 0;
  while (x) {
    res++;
    x /= 10;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  n = s.size();
  for (int i = 0; i < 8008; i++) dp[i] = 1000000000;
  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    func();
    string str = "";
    for (int j = 1; j < s.size(); j++) str += s[j];
    s = str;
    for (int j = i + 1; j <= n; j++) {
      int p = j - i;
      int k = p - f[p - 1];
      if (k && p % k == 0) p = k;
      dp[j] = min(dp[j], dp[i] + calc((j - i) / p) + p);
    }
  }
  cout << dp[n] << endl;
}
