
#include <fstream>
#include <string>
#include <vector>
#include <list>

#include <iostream>

int numlen(int x)
{
  if (x == 0) return 1;

  int res = 0;
  while (x > 0)
  {
    res++;
    x /= 10;
  }

  return res;
}

int main (int argc, char** argv)
{
  std::string sourceStr;
  std::vector<std::vector<int> > f;
  std::list<std::pair<int, std::string> > strs;
  std::vector<int> w, c, l;
  int n, p;

  std::fstream input("input.txt", std::ios_base::in);
  std::fstream output("output.txt", std::ios_base::out);
  
//  input >> sourceStr;
  std::getline(input, sourceStr);
  n = sourceStr.length();

  w.resize(n + 1); c.resize(n + 1); l.resize(n + 1);

  f.resize(n + 1);
  for (int i = 0; i < n; ++i) f[i].resize(n + 1);

  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j <= i; ++j)
    {
      int t = f[j][i - j];
      while (t > 0 && sourceStr[i] != sourceStr[j + t]) t = f[j][t];
      if (t > 0 || i > j && sourceStr[i]  == sourceStr[j])
        f[j][i - j + 1] = t + 1;
      else
        f[j][i - j + 1] = 0;
    }
  }

  for (int i = 1; i <= n; ++i)
  {
    w[i] = i + 1;
    c[i] = 1;
    l[i] = i;
    for (int j = 0; j < i; j++)
    {
      if (w[j] + i - j + 1 < w[i])
      {
        c[i] = 1;
        l[i] = i - j;
        w[i] = w[j] + i - j + 1;
      }

      int tc = (i - j) / (i - j - f[j][i - j]);
      int tl = i - j - f[j][i - j];

      if ((i - j) % tl == 0 && w[j] + tl + numlen(tc) < w[i])
      {
        c[i] = tc;
        l[i] = tl;
        w[i] = w[j] + tl + numlen(tc);
      }
    }
  }

  p = n;
  while (p > 0)
  {
    strs.push_front(std::pair<int, std::string>(c[p], sourceStr.substr(p - l[p]*c[p], l[p])));
    p -= l[p]*c[p];
  }

  for (std::list<std::pair<int, std::string> >::const_iterator it = strs.begin(); it != strs.end(); ++it)
    output << it->second << it->first;

  return 0;
}
