#include <bits/stdc++.h>
using namespace std;
string str;
int dp[8008];
vector<int> pi[8008];
int cnt[100005];
void go(int st) {
  string p;
  for (int i = st; i < str.size(); i++) p.push_back(str[i]);
  pi[st] = vector<int>((int)str.size() - st, 0);
  int j = 0;
  for (int i = 1; i < p.size(); i++) {
    while (j != 0 && p[i] != p[j]) {
      j = pi[st][j - 1];
    }
    if (p[i] == p[j]) {
      pi[st][i] = ++j;
    }
  }
}
int dfs(int now) {
  int& ret = dp[now];
  if (ret != -1) return ret;
  if (now == (int)str.size()) return ret = 0;
  ret = 1e9;
  for (int i = now; i < str.size(); i++) {
    int len = i - now + 1 - pi[now][i - now];
    if ((i - now + 1) % len == 0) {
      ret = min(ret, cnt[(i - now + 1) / len] + len + dfs(i + 1));
    } else {
      ret = min(ret, (i - now + 1) + 1 + dfs(i + 1));
    }
  }
  return ret;
}
int main() {
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < 10; i++) cnt[i] = 1;
  for (int i = 10; i < 100; i++) cnt[i] = 2;
  for (int i = 100; i < 1000; i++) cnt[i] = 3;
  for (int i = 1000; i < 10000; i++) cnt[i] = 4;
  cin >> str;
  for (int i = 0; i < str.size(); i++) go(i);
  int ans = dfs(0);
  printf("%d", ans);
}
