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;
const int Maxk = 1005;
string mul(string a, string b) {
  int res[Maxk];
  memset(res, 0, sizeof(res));
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  for (int i = 0; i < a.length(); i++) {
    for (int j = 0; j < b.length(); j++) {
      res[i + j] += (a[i] - '0') * (b[j] - '0');
    }
  }
  for (int i = 0; i < Maxk; i++) {
    if (res[i] >= 10) {
      res[i + 1] += (res[i] / 10);
      res[i] %= 10;
    }
  }
  string ret;
  bool flag = false;
  for (int i = Maxk - 1; i >= 0; i--) {
    if (flag || res[i]) {
      flag = true;
      ret = ret + (char)(res[i] + '0');
    }
  }
  if (ret == "") ret = "0";
  return ret;
}
string add(string a, string b) {
  if (a.length() < b.length()) swap(a, b);
  while (a.length() != b.length()) {
    b = '0' + b;
  }
  for (int i = a.length() - 1; i >= 0; i--) {
    a[i] += (b[i] - '0');
    if (a[i] > '9' && i) {
      a[i] -= 10;
      a[i - 1]++;
    }
  }
  if (a[0] > '9') {
    a[0] -= 10;
    a = '1' + a;
  }
  return a;
}
const int Maxn = 8005;
int fail[Maxn][Maxn];
int dp[Maxn];
int pre[Maxn];
void getf(string kk) {
  for (int i = 0; i < kk.length(); i++) {
    string s = kk.substr(i);
    for (int j = 1; j < s.length(); j++) {
      int k = fail[i][j];
      while (k && s[j] != s[k]) k = fail[i][k];
      fail[i][j + 1] = (s[j] == s[k]) ? k + 1 : 0;
    }
  }
}
int g(int x) {
  int ret = 0;
  while (x) {
    ret++;
    x /= 10;
  }
  return ret;
}
int main() {
  string x;
  cin >> x;
  getf(x);
  dp[1] = 2;
  for (int i = 2; i <= x.length(); i++) {
    dp[i] = 1e9;
    for (int j = 0; j < i; j++) {
      int val = fail[j][i - j];
      if (val * 2 >= i - j && (i - j) % (i - j - val) == 0) {
        int len = i - j - val;
        int t = (i - j) / len;
        if (dp[j] + len + g(t) < dp[i]) {
          dp[i] = dp[j] + len + g(t);
        }
      } else {
        int len = i - j;
        int t = (i - j) / len;
        if (dp[j] + len + g(t) < dp[i]) {
          dp[i] = dp[j] + len + g(t);
        }
      }
    }
  }
  printf("%d\n", dp[(int)x.length()]);
}