#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  vector<int> cnt(n + 1, 0), dp(n + 1);
  iota(dp.begin() + 1, dp.end(), 2);
  for (int i = 1; i <= n; i++) cnt[i] = cnt[i / 10] + 1;
  auto KMP = [&](const string &s) {
    int n = s.length();
    vector<int> lps(n + 1, 0);
    for (int i = 1; i < n; i++) {
      int j = lps[i];
      while (j and s[i] != s[j]) j = lps[j];
      if (s[i] == s[j]) j++;
      lps[i + 1] = j;
    }
    return lps;
  };
  for (int i = 0; i < n; i++) {
    string c = s.substr(i);
    vector<int> lps = KMP(c);
    for (int j = 1; j + i <= n; j++) {
      int l = j - lps[j];
      if (j % l)
        dp[i + j] = min(dp[i + j], dp[i] + j + 1);
      else
        dp[i + j] = min(dp[i + j], dp[i] + cnt[j / l] + l);
    }
  }
  cout << dp[n] << '\n';
}
