#include <bits/stdc++.h>
long long max(long long x, long long y) { return (x > y ? x : y); }
long long min(long long x, long long y) { return (x < y ? x : y); }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
using namespace ::std;
const int maxn = 8100;
const int inf = 1e8;
int dp[maxn];
int tol[maxn];
int phi[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i < maxn; i++) {
    tol[i] = tol[i / 10] + 1;
  }
  string s;
  cin >> s;
  int n = s.size();
  dp[n - 1] = 2;
  for (int i = n - 2; i >= 0; i--) {
    string t;
    for (int j = i; j < n; j++) {
      t += s[j];
    }
    phi[1] = 0;
    for (int j = 1; j < t.size(); j++) {
      int k = phi[j];
      while (k && t[j] != t[k]) {
        k = phi[k];
      }
      if (t[j] == t[k]) k++;
      phi[j + 1] = k;
    }
    dp[i] = inf;
    int XW = n - i;
    for (int j = 1; j <= XW; j++) {
      int res = j - phi[j];
      if (j % res != 0) {
        res = j;
      }
      res += tol[j / res];
      dp[i] = min(dp[i], dp[i + j] + res);
    }
  }
  cout << dp[0];
}
