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 n, mem[8010], dig[8080];
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;
long long hsh1[8010], hsh2[8010], pwr1[8080], pwr2[8080];
bool l[8080];
int dp(int x) {
  memset(l, 0, sizeof l);
  int tmp, res = 1e9, j;
  long long hsh11, hsh12, hsh21, hsh22;
  for (int i = x; i < n; ++i) {
    if (l[i]) continue;
    tmp = 1;
    j = i;
    while (1) {
      l[j] = 1;
      res = min(res, dig[tmp] + i - x + 1 + mem[j + 1]);
      ++tmp;
      j += i - x + 1;
      if (j >= n) break;
      if (x == 0) {
        hsh11 = hsh1[j] - pwr1[i - x + 1] * hsh1[j - (i - x) - 1];
        hsh11 %= mod1;
        if (hsh11 < 0) hsh11 += mod1;
        hsh12 = hsh1[i];
        hsh21 = hsh2[j] - pwr2[i - x + 1] * hsh2[j - (i - x) - 1];
        hsh21 %= mod2;
        if (hsh21 < 0) hsh21 += mod2;
        hsh22 = hsh2[i];
      } else {
        hsh11 = hsh1[j] - pwr1[i - x + 1] * hsh1[j - (i - x) - 1];
        hsh11 %= mod1;
        if (hsh11 < 0) hsh11 += mod1;
        hsh12 = hsh1[i] - pwr1[i - x + 1] * hsh1[x - 1];
        hsh12 %= mod1;
        if (hsh12 < 0) hsh12 += mod1;
        hsh21 = hsh2[j] - pwr2[i - x + 1] * hsh2[j - (i - x) - 1];
        hsh21 %= mod2;
        if (hsh21 < 0) hsh21 += mod2;
        hsh22 = hsh2[i] - pwr2[i - x + 1] * hsh2[x - 1];
        hsh22 %= mod2;
        if (hsh22 < 0) hsh22 += mod2;
      }
      if (hsh11 != hsh12 || hsh21 != hsh22) break;
    }
  }
  mem[x] = res;
  return res;
}
char s[8080];
int a[8080];
int main() {
  memset(mem, 0, sizeof mem);
  scanf("%s", s);
  n = strlen(s);
  for (int i = 0; i < n; ++i) {
    a[i] = s[i] - 'a';
  }
  hsh1[0] = hsh2[0] = a[0] + 1;
  pwr1[0] = pwr2[0] = 1;
  for (int i = 1; i <= n; ++i) {
    pwr1[i] = (pwr1[i - 1] * 27) % mod1;
    pwr2[i] = (pwr2[i - 1] * 27) % mod2;
    hsh1[i] = ((long long)(hsh1[i - 1]) * 27 + a[i] + 1) % mod1;
    hsh2[i] = ((long long)(hsh2[i - 1]) * 27 + a[i] + 1) % mod2;
  }
  for (int i = 1; i <= n; ++i) {
    dig[i] = 1 + (i >= 10) + (i >= 100) + (i >= 1000);
  }
  for (int i = n - 1; i >= 0; --i) dp(i);
  int ans = mem[0];
  printf("%d", ans);
  return 0;
}