#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <climits>
#include <cstring>
#include <utility>
#include <vector>
#include <string>
#include <cstdio>
#include <bitset>
#include <ctime>
#include <cmath>
#include <stack>
#include <list>
#include <set>
#include <map>
using namespace std;
#define sci stack <int>
#define vci vector <int>
#define vcs vector <string>
#define vcd vector <double>
#define vci64 vector <long long>
#define seti set <int>
#define mseti multiset <int>
const int maxn = 100 + 5;
typedef unsigned int uint;
typedef long long int64;
typedef unsigned long long uint64;
template <class T> inline T Sqr(const T & x) { return x * x; }
template <class T> inline T Abs(const T & x) { return x > 0 ? x : -x; }
template <class T> inline T Min(const T & a, const T & b) { return a < b ? a : b; }
template <class T> inline T Max(const T & a, const T & b) { return a > b ? a : b; }
template <class T> inline T Ksm(const T & a, const T & b, const T & m) { T _ = 1; for (; b; b >>= 1, a = a * a % m) (b & 1) ? _ = _ * a % m : 0; return _ % m; }
template <class T> inline void Swap(T & a, T & b) { T _; _ = a; a = b; b = _; }
char str[maxn];
int f[maxn][maxn];
int bit[4] = { 0, 100, 10, 1 };
int getint()
{
char ch = getchar(); int result = 0, res = 1;
for (; '0' > ch || ch > '9'; ch = getchar()) ch == '-' ? res = -1 : 0;
for (; '0' <= ch && ch <= '9'; result = result * 10 + ch - '0', ch = getchar());
return result * res;
}
bool check(int l, int mid, int r)
{
int lens, lent;
if ((lent = r - l + 1) % (lens = mid - l + 1) != 0) return 0;
for (int i = l + lens; i <= r; i += lens)
for (int j = 0; j <= lens - 1; ++j)
if (str[l + j - 1] != str[i + j - 1]) return 0;
return 1;
}
int calc(int num)
{
for (int i = 1; i <= 3; ++i)
if (num >= bit[i]) return 3 - i + 1;
return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("1090.in", "r", stdin);
freopen("1090.out", "w", stdout);
#endif
scanf("%s", str); int len = strlen(str);
memset(f, 1, sizeof(f));
for (int i = 1; i <= len; ++i) f[i][i] = 1;
for (int k = 1; k <= len; ++k)
for (int i = 1; i + k <= len; ++i)
for (int j = i, g = 0; j + 1 <= i + k; ++j)
{
f[i][i + k] = Min(f[i][i + k], f[i][j] + f[j + 1][i + k]);
if (check(i, j, i + k)) f[i][i + k] =
Min(f[i][i + k], g = Min(calc((k + 1) / (j - i + 1)) + 2 + f[i][j], k + 1));
}
printf("%d\n", f[1][len]);
return 0;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGxpYj4KI2luY2x1ZGUgPGNsaW1pdHM+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGJpdHNldD4KI2luY2x1ZGUgPGN0aW1lPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzdGFjaz4KI2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBzY2kgc3RhY2sgPGludD4KI2RlZmluZSB2Y2kgdmVjdG9yIDxpbnQ+CiNkZWZpbmUgdmNzIHZlY3RvciA8c3RyaW5nPgojZGVmaW5lIHZjZCB2ZWN0b3IgPGRvdWJsZT4KI2RlZmluZSB2Y2k2NCB2ZWN0b3IgPGxvbmcgbG9uZz4KI2RlZmluZSBzZXRpIHNldCA8aW50PgojZGVmaW5lIG1zZXRpIG11bHRpc2V0IDxpbnQ+Cgpjb25zdCBpbnQgbWF4biA9IDEwMCArIDU7Cgp0eXBlZGVmIHVuc2lnbmVkIGludCB1aW50Owp0eXBlZGVmIGxvbmcgbG9uZyBpbnQ2NDsKdHlwZWRlZiB1bnNpZ25lZCBsb25nIGxvbmcgdWludDY0OwoKdGVtcGxhdGUgPGNsYXNzIFQ+IGlubGluZSBUIFNxcihjb25zdCBU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ZXM7Cn0KCmJvb2wgY2hlY2soaW50IGwsIGludCBtaWQsIGludCByKQp7CiAgIGludCBsZW5zLCBsZW50OwogICBpZiAoKGxlbnQgPSByIC0gbCArIDEpICUgKGxlbnMgPSBtaWQgLSBsICsgMSkgIT0gMCkgcmV0dXJuIDA7CiAgIGZvciAoaW50IGkgPSBsICsgbGVuczsgaSA8PSByOyBpICs9IGxlbnMpCiAgICAgIGZvciAoaW50IGogPSAwOyBqIDw9IGxlbnMgLSAxOyArK2opCiAgICAgICAgIGlmIChzdHJbbCArIGogLSAxXSAhPSBzdHJbaSArIGogLSAxXSkgcmV0dXJuIDA7CiAgIHJldHVybiAxOwp9CgppbnQgY2FsYyhpbnQgbnVtKQp7CiAgIGZvciAoaW50IGkgPSAxOyBpIDw9IDM7ICsraSkKICAgICAgaWYgKG51bSA+PSBiaXRbaV0pIHJldHVybiAzIC0gaSArIDE7CiAgIHJldHVybiAwOwp9CgppbnQgbWFpbigpCnsKI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgZnJlb3BlbigiMTA5MC5pbiIsICJyIiwgc3RkaW4pOwogICBmcmVvcGVuKCIxMDkwLm91dCIsICJ3Iiwgc3Rkb3V0KTsKI2VuZGlmCgogICBzY2FuZigiJXMiLCBzdHIpOyBpbnQgbGVuID0gc3RybGVuKHN0cik7CiAgIG1lbXNldChmLCAxLCBzaXplb2YoZikpOwogICBmb3IgKGludCBpID0gMTsgaSA8PSBsZW47ICsraSkgZltpXVtpXSA9IDE7CiAgIGZvciAoaW50IGsgPSAxOyBrIDw9IGxlbjsgKytrKQogICAgICBmb3IgKGludCBpID0gMTsgaSArIGsgPD0gbGVuOyArK2kpCiAgICAgICAgIGZvciAoaW50IGogPSBpLCBnID0gMDsgaiArIDEgPD0gaSArIGs7ICsraikKICAgICAgICAgewogICAgICAgICAgICBmW2ldW2kgKyBrXSA9IE1pbihmW2ldW2kgKyBrXSwgZltpXVtqXSArIGZbaiArIDFdW2kgKyBrXSk7CiAgICAgICAgICAgIGlmIChjaGVjayhpLCBqLCBpICsgaykpIGZbaV1baSArIGtdID0gCiAgICAgICAgICAgICAgIE1pbihmW2ldW2kgKyBrXSwgZyA9IE1pbihjYWxjKChrICsgMSkgLyAoaiAtIGkgKyAxKSkgKyAyICsgZltpXVtqXSwgayArIDEpKTsKICAgICAgICAgfQogICBwcmludGYoIiVkXG4iLCBmWzFdW2xlbl0pOwoKICAgcmV0dXJuIDA7Cn0=