#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
char s[8001];
short kmp[8000][8000];
int dp[8001], n;
inline int cst(int x) { int an = 0; while (x)++an, x /= 10; return an; }
int S(int l, int r){
--l, --r;
/*int &an = sh[l][r];
if (an)return an;
int k = kmp[l][r];*/
return r - l + 1 - kmp[l][r - l];
}
int main(){
scanf("%s", s);
n = strlen(s);
f(i, 0, n){
int k = 0;
f(j, 1, n - i){
while (k && s[j + i] != s[k + i])k = kmp[i][k - 1];
if (s[j + i] == s[k + i])++k;
kmp[i][j] = k;
}
}
dp[0] = 0;
f(i, 1, n + 1){
dp[i] = 1e9;
f(j, 1, i + 1){
int l = S(j, i);
if ((i - j + 1) % l)l = i - j + 1;
dp[i] = min(dp[i], dp[j - 1] + l + cst((i - j + 1) / l));
}
}
printf("%d\n", dp[n]);
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZihpLCB4LCBuKSBmb3IgKGludCBpID0geDsgaSA8IChpbnQpKG4pOyArK2kpCiAKY2hhciBzWzgwMDFdOwpzaG9ydCBrbXBbODAwMF1bODAwMF07CmludCBkcFs4MDAxXSwgbjsKIAppbmxpbmUgaW50IGNzdChpbnQgeCkgeyBpbnQgYW4gPSAwOyB3aGlsZSAoeCkrK2FuLCB4IC89IDEwOyByZXR1cm4gYW47IH0KIAppbnQgUyhpbnQgbCwgaW50IHIpewoJLS1sLCAtLXI7CgkvKmludCAmYW4gPSBzaFtsXVtyXTsKCWlmIChhbilyZXR1cm4gYW47CglpbnQgayA9IGttcFtsXVtyXTsqLwoJcmV0dXJuIHIgLSBsICsgMSAtIGttcFtsXVtyIC0gbF07Cn0KIAppbnQgbWFpbigpewoJc2NhbmYoIiVzIiwgcyk7CgluID0gc3RybGVuKHMpOwoJZihpLCAwLCBuKXsKCQlpbnQgayA9ID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