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 a[8005], n, cnt[8005], o[8005], dp[8005][8005];
long long e[8005], f[8005], g[8005], h[8005];
int main() {
  char in = getchar();
  while (in != '\n') a[++n] = in - 96, in = getchar();
  for (int i = 1; i <= n; i++) {
    int end = n + 1 - i;
    if (i == 1) {
      for (int j = 1; j <= n; j++) e[j] = f[j] = g[j] = h[j] = a[j] * 1ll;
    } else {
      for (int j = 1; j <= end; j++) {
        e[j] = e[j] * 998244353ll + a[j + i - 1] * 1ll;
        f[j] = (f[j] * 31ll + a[j + i - 1] * 1ll) % 1000000007ll;
        g[j] = g[j] * 23333ll + a[j + i - 1] * 1ll;
        h[j] = h[j] * 1000000007ll + a[j + i - 1] * 1ll;
      }
    }
    for (int j = 1; j <= end; j++) {
      int k = i + j - 1;
      if (dp[j][k]) continue;
      dp[j][k] = 1;
      int s = 1;
      for (int l = k + 1; l <= end; l += i) {
        if (e[l] != e[j] || f[l] != f[j] || g[l] != g[j] || h[l] != h[j]) break;
        dp[l][l + i - 1] = ++s;
      }
    }
  }
  for (int i = 1; i <= 9; i++) cnt[i] = 1;
  for (int i = 10; i <= 99; i++) cnt[i] = 2;
  for (int i = 100; i <= 999; i++) cnt[i] = 3;
  for (int i = 1000; i <= 8000; i++) cnt[i] = 4;
  for (int i = 1; i <= n; i++) {
    o[i] = o[i - 1] + 2;
    int s = 0;
    for (int j = i; j; j--) {
      s++;
      for (int k = 1; k <= dp[j][i]; k++)
        o[i] = min(o[i], o[i - k * s] + cnt[k] + s);
    }
  }
  printf("%d\n", o[n]);
  return 0;
}