#include <bits/stdc++.h>
using namespace std;
int pi[8005][8005], dp[8005], lg[8005];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; lg[i] = log10(i), ++i)
    for (int j = 1, k = 0, _n = n - i; j < _n; ++j) {
      while (k && s[i + j] != s[i + k]) k = pi[i][k - 1];
      k += s[i + j] == s[i + k];
      pi[i][j] = k;
    }
  lg[n] = log10(n);
  memset(dp, 63, sizeof dp);
  dp[0] = 0;
  for (int i = 1, l, c; i <= n; ++i)
    for (int j = 1; j <= i; ++j) {
      l = i - j + 1;
      c = l - pi[j - 1][l - 1];
      dp[i] = min(dp[i], dp[j - 1] + (l % c == 0 ? c + lg[l / c] : l) + 1);
    }
  cout << dp[n];
  return 0;
}
