#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
};
template <class A, class B>
ostream &operator<<(ostream &os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, rge<T> d) {
  os << "[";
  for (auto it = d.b; it != d.e; it++) os << (it == d.b ? "" : ", ") << *it;
  return os << "]";
}
const int N = 8005;
int lps[N][N];
int dp[N], digits[N];
char s[N];
int n;
template <class T>
void umin(T &a, T b) {
  a = min(a, b);
}
void pre_kmp(int n, char s[], int lps[]) {
  lps[0] = 0;
  for (int i = (1); i <= ((n - 1)); i += (+1)) {
    int j = lps[i - 1];
    while (j > 0 && s[i] != s[j]) {
      j = lps[j - 1];
    }
    lps[i] = j + (s[i] == s[j]);
  }
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  cin >> s;
  n = strlen(s);
  for (int i = (0); i <= ((n + 1) - 1); i += (+1)) {
    digits[i] = log10(i) + 1;
    pre_kmp(n - i, s + i, lps[i]);
  }
  for (int len = (1); len <= ((n)); len += (+1)) {
    dp[len] = N;
  }
  dp[0] = 0;
  for (int r = (0); r <= ((n)-1); r += (+1)) {
    for (int l = (0); l <= ((r + 1) - 1); l += (+1)) {
      int len = r - l + 1;
      int period = len - lps[l][len - 1];
      umin(dp[r + 1],
           dp[l] + (period && len % period == 0 ? digits[len / period] + period
                                                : digits[1] + len));
    }
  }
  cout << min(digits[1] + n, dp[n]) << '\n';
  return 0;
}
