Problem: Ivan wants to write a letter to his friend. The letter is a string s consisting of lowercase Latin letters.

Unfortunately, when Ivan started writing the letter, he realised that it is very long and writing the whole letter may take extremely long time. So he wants to write the compressed version of string s instead of the string itself.

The compressed version of string s is a sequence of strings c1, s1, c2, s2, ..., ck, sk, where ci is the decimal representation of number ai (without any leading zeroes) and si is some string consisting of lowercase Latin letters. If Ivan writes string s1 exactly a1 times, then string s2 exactly a2 times, and so on, the result will be string s.

The length of a compressed version is |c1| + |s1| + |c2| + |s2|... |ck| + |sk|. Among all compressed versions Ivan wants to choose a version such that its length is minimum possible. Help Ivan to determine minimum possible length.

Input

The only line of input contains one string s consisting of lowercase Latin letters (1 ≤ |s| ≤ 8000).

Output

Output one integer number — the minimum possible length of a compressed version of s.

Examples

Input

aaaaaaaaaa


Output

3


Input

abcab


Output

6


Input

cczabababab


Output

7

Note

In the first example Ivan will choose this compressed version: c1 is 10, s1 is a.

In the second example Ivan will choose this compressed version: c1 is 1, s1 is abcab.

In the third example Ivan will choose this compressed version: c1 is 2, s1 is c, c2 is 1, s2 is z, c3 is 4, s3 is ab.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int dp[10000];
struct simplehash {
  int len;
  long long base, mod;
  vector<int> P, H, R;
  simplehash() {}
  simplehash(const char* str, long long b, long long m) {
    base = b, mod = m, len = strlen(str);
    P.resize(len + 3, 1), H.resize(len + 3, 0), R.resize(len + 3, 0);
    for (int i = 1; i <= len; i++) P[i] = (P[i - 1] * base) % mod;
    for (int i = 1; i <= len; i++)
      H[i] = (H[i - 1] * base + str[i - 1] + 1007) % mod;
    for (int i = len; i >= 1; i--)
      R[i] = (R[i + 1] * base + str[i - 1] + 1007) % mod;
  }
  inline int range_hash(int l, int r) {
    int hashval = H[r + 1] - ((long long)P[r - l + 1] * H[l] % mod);
    return (hashval < 0 ? hashval + mod : hashval);
  }
  inline int reverse_hash(int l, int r) {
    ;
    int hashval = R[l + 1] - ((long long)P[r - l + 1] * R[r + 2] % mod);
    return (hashval < 0 ? hashval + mod : hashval);
  }
};
struct stringhash {
  simplehash sh1, sh2;
  stringhash() {}
  stringhash(const char* str) {
    sh1 = simplehash(str, 1949313259, 2091573227);
    sh2 = simplehash(str, 1997293877, 2117566807);
  }
  inline long long range_hash(int l, int r) {
    return ((long long)sh1.range_hash(l, r) << 32) ^ sh2.range_hash(l, r);
  }
  inline long long reverse_hash(int l, int r) {
    return ((long long)sh1.reverse_hash(l, r) << 32) ^ sh2.reverse_hash(l, r);
  }
} S;
char str[1000005];
int dig[10000], help[8002][8002];
int total_digit(int num) {
  int cnt = 0;
  while (num != 0) {
    num = num / 10;
    cnt++;
  }
  return cnt;
}
int main() {
  int i, len, j, sz, l, r, p1, p2, p3, p4, pos, k;
  for (i = 0; i < 10000; i++) dig[i] = total_digit(i);
  scanf("%s", str);
  len = strlen(str);
  S = stringhash(str);
  for (i = len - 1; i >= 0; i--) {
    for (j = 1; j <= len; j++) {
      p1 = i;
      p2 = p1 + j - 1;
      p3 = p2 + 1;
      p4 = p3 + j - 1;
      help[i][j] = 1;
      if (p4 >= len) continue;
      if (S.range_hash(p1, p2) == S.range_hash(p3, p4)) {
        help[i][j] = help[p3][j] + 1;
      }
    }
  }
  for (i = 0; i <= len; i++) dp[i] = 1e8;
  for (i = 0; i < len; i++) {
    for (j = 1; j <= len; j++) {
      for (k = 1; k <= help[i][j]; k++) {
        pos = i + j * k - 1;
        if (pos >= len) break;
        if (i - 1 < 0) {
          dp[pos] = min(dp[pos], j + dig[k]);
        } else {
          dp[pos] = min(dp[pos], dp[i - 1] + j + dig[k]);
        }
      }
    }
  }
  cout << dp[len - 1] << endl;
}