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<string> split(const string& s, char c = ' ') {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, int n) {
  stringstream s;
  s << "[";
  for (int i = 0; i < n - 1; i++) s << arr[i] << ",";
  s << arr[n - 1] << "]";
  return s.str();
}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template <typename T>
inline void __evars_out_var(vector<T> val) {
  cerr << arrStr(val, val.size());
}
template <typename T>
inline void __evars_out_var(T* val) {
  cerr << arrStr(val, 10);
}
template <typename T>
inline void __evars_out_var(T val) {
  cerr << val;
}
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template <typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
  __evars_out_var(a);
  cerr << "; ";
  __evars(++it, args...);
}
const int mod = 1000000007;
const int N = 2e5 + 10;
const int M = 5e3 + 15;
void mina(int& a, int b) {
  if (a > b) a = b;
}
int calc[8008][8008];
int nd[8008];
void caaar() {
  for (int i = 1; i < 8008; ++i) {
    int t = i;
    while (t > 0) {
      t = t / 10;
      nd[i]++;
    }
  }
  string s;
  cin >> s;
  int n = s.length();
  bool f = true;
  for (int i = 1; i < n; ++i) {
    if (s[i] != s[0]) f = false;
  }
  if (f) {
    cout << nd[n] + 1;
    return;
  }
  for (int j = 0; j < n; ++j) {
    vector<int> z(n);
    for (int i = j + 1, l = j, r = j; i < n; ++i) {
      if (i <= r) z[i] = min(r - i + 1, z[i - l + j]);
      while (i + z[i] < n && s[j + z[i]] == s[i + z[i]]) ++z[i];
      if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
    }
    for (int i = j; i < n; ++i) calc[j][i] = i - j + 2;
    for (int i = j + 1; i < n; ++i) {
      int l = i - j, t, cmp = z[i] + i - j, c = 2;
      t = 2 * l;
      while (t <= n - j) {
        if (cmp >= t) mina(calc[j][j + t - 1], l + nd[c]);
        t += l;
        c++;
      }
    }
  }
  vector<int> dp(n + 1, n + 10);
  dp[0] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < i; ++j) mina(dp[i], dp[j] + calc[j][i - 1]);
  }
  cout << dp[n];
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tc = 1;
  for (int i = 1; i <= tc; ++i) {
    caaar();
    if (i < tc) cout << "\n";
  }
  return 0;
}