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;
vector<vector<pair<int, short int> > > dp;
int ans[8010], num_digits[8010];
const int mod = 1000000007ll, base = 59;
char s[8010];
void digit_count() {
  int num = 0;
  for (int i = 1; i < 8010; ++i) {
    if (i == 1 || i == 10 || i == 100 || i == 1000)
      num_digits[i] = ++num;
    else
      num_digits[i] = num;
  }
}
int main() {
  scanf("%s", s);
  int l = strlen(s), len = l + 2;
  for (int i = 0; i < l; ++i) {
    ans[i] = 8010 + 8010;
    pair<int, short int> t = make_pair(-1, 1);
    dp.push_back(vector<pair<int, short int> >(len, t));
    --len;
  }
  digit_count();
  ans[l] = 0;
  for (int i = l - 1; i >= 0; --i) {
    long long hsh = 0;
    for (int j = i; j < l; ++j) {
      int diff = j - i + 1, res = 8010 + 8010;
      hsh = ((1ll * hsh * base) % (1ll * mod) + s[j] - 'a') % mod;
      if (diff < l - j && hsh == dp[j + 1][diff].first) {
        int num = dp[j + 1][diff].second, pos = j + num * diff + 1;
        res = ans[pos] + diff + num_digits[num + 1];
        dp[i][diff].second = num + 1;
      }
      if (res >= ans[i + diff] + diff + 1) {
        dp[i][diff].second = 1;
        res = ans[i + diff] + diff + 1;
      }
      dp[i][diff].first = hsh;
      ans[i] = min(ans[i], res);
    }
  }
  printf("%d\n", ans[0]);
  return 0;
}