#include <bits/stdc++.h>
using namespace std;
template <typename T>
void __read(T &a) {
  cin >> a;
}
template <typename T, typename... Args>
void __read(T &a, Args &...args) {
  cin >> a;
  __read(args...);
}
constexpr long long M7 = 1000000007ll;
constexpr long long M9 = 1000000009ll;
constexpr long long MFFT = 998244353ll;
template <class T>
void outv(T &a) {
  for (auto &x : a) cout << x << ' ';
}
static mt19937 rnd(static_cast<unsigned>(
    chrono::steady_clock::now().time_since_epoch().count()));
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr));
int32_t main() {
  string s;
  __read(s);
  long long n = s.length();
  vector<pair<long long, basic_string<long long>>> res(n);
  basic_string<long long> cur;
  vector<long long> pr;
  for (long long i = n - 1; i >= 0; --i) {
    if (!cur.empty() && i + 1 == cur.back() && s[i] == s[cur.back()]) {
      if (pr.back() == n || s[pr.back()] < s[i]) {
        cur.pop_back();
        pr.pop_back();
      } else {
        cur.push_back(i);
      }
    } else {
      cur.push_back(i);
    }
    if (!cur.empty()) {
      if (cur.size() == 1) {
        pr.push_back(n);
      } else {
        if (s[cur.back()] == s[cur[cur.size() - 2]]) {
          pr.push_back(pr.back());
        } else {
          pr.push_back(cur[cur.size() - 2]);
        }
      }
    }
    if (cur.size() > 10) {
      long long len = cur.size();
      auto z = cur.substr(0, 2);
      z.push_back(n);
      z.push_back(n);
      z.push_back(n);
      z += cur.substr(len - 5);
      res[i] = {len, z};
    } else {
      res[i] = {cur.size(), cur};
    }
  }
  s.push_back('.');
  for (auto &[len, str] : res) {
    reverse((str).begin(), (str).end());
    cout << len << ' ';
    for (long long i : str) {
      cout << s[i];
    }
    cout << '\n';
  }
  return 0;
}
