#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = (int)1e9 + 7;
const int N = (int)8e3 + 7;
char s[N];
int len, dig[N], cost[N][N], dp[N];
int net[N];
void Get(char *p, int m) {
  net[0] = -1;
  for (int i = 0, j = -1; i < m;) {
    if (j == -1 || p[i] == p[j])
      net[++i] = ++j;
    else
      j = net[j];
  }
}
void Init() {
  for (int i = (1); i < (N); ++i) dig[i] = dig[i / 10] + 1;
  len = strlen(s + 1);
  for (int i = (1); i < (len + 1); ++i) {
    Get(s + i, len - i + 1);
    for (int j = (i); j < (len + 1); ++j) {
      if (j == i)
        cost[i][j] = 2;
      else {
        int tlen = j - i + 1;
        if (tlen % (tlen - net[tlen]) == 0) {
          int cnt = tlen / (tlen - net[tlen]);
          cost[i][j] = dig[cnt] + tlen - net[tlen];
        } else {
          cost[i][j] = 1 + tlen;
        }
      }
    }
  }
}
int Solve() {
  for (int i = (1); i < (len + 1); ++i) {
    dp[i] = cost[1][i];
    for (int j = (1); j < (i); ++j) dp[i] = min(dp[i], dp[j] + cost[j + 1][i]);
  }
  return printf("%d\n", dp[len]);
}
int main() {
  while (~scanf("%s", s + 1)) {
    Init();
    Solve();
  }
  return 0;
}
