#include <bits/stdc++.h>
using namespace std;
const int inf = 10e5;
vector<int> lps(string s) {
  int n = s.length();
  vector<int> r(n, 0);
  int j = 0;
  for (int i = 1; i < n;) {
    if (s[i] == s[j]) {
      r[i] = j + 1;
      i++;
      j++;
    } else {
      j ? j = r[j - 1] : i++;
    }
  }
  return r;
}
int ilg(int sk) {
  if (sk < 10) return 1;
  if (sk < 100) return 2;
  if (sk < 1000) return 3;
  if (sk < 10000) return 4;
}
int main() {
  string s;
  cin >> s;
  int n = s.length();
  vector<vector<int> > a(n, vector<int>(n, inf));
  for (int i = 0; i < n; i++) {
    vector<int> t = lps(s.substr(i));
    for (int j = 0; j < t.size(); j++) {
      int len = j + 1;
      a[i][i + j] =
          ((len % (len - t[j]) == 0) ? (len - t[j] + ilg(len / (len - t[j])))
                                     : (len + 1));
    }
  }
  vector<int> dp(n, inf);
  dp[0] = 2;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i] = min(dp[i], a[j][i] + (j ? dp[j - 1] : 0));
    }
  }
  cout << dp[n - 1];
}
