#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long N = 8008;
string s;
long long n;
vector<long long> pref[N];
long long dp[N];
vector<long long> prefix_function(string s) {
  reverse(s.begin(), s.end());
  long long n = (long long)s.length();
  vector<long long> pi(n);
  for (long long i = 1; i < n; i++) {
    long long j = pi[i - 1];
    while (j > 0 && s[i] != s[j]) j = pi[j - 1];
    if (s[i] == s[j]) j++;
    pi[i] = j;
  }
  return pi;
}
long long len(long long x) {
  long long c = 0;
  while (x) {
    c++;
    x /= 10;
  }
  return c;
}
long long f(long long ind) {
  if (ind == n) return 0;
  if (dp[ind] != -1) {
    return dp[ind];
  }
  long long& val = dp[ind];
  val = 1000000000000000001;
  for (long long j = ind; j < n; j++) {
    long long k = (j - ind + 1) - pref[ind][j - ind];
    long long cost, p;
    if ((j - ind + 1) % k == 0) {
      cost = k;
      p = (j - ind + 1) / k;
    } else {
      cost = (j - ind + 1);
      p = 1;
    }
    val = min(val, len(p) + cost + f(j + 1));
  }
  return val;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> s;
  n = s.size();
  string temp = "";
  for (long long i = n - 1; i >= 0; i--) {
    temp += s[i];
    pref[i] = prefix_function(temp);
  }
  memset(dp, -1, sizeof(dp));
  cout << f(0) << "\n";
}
