#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  string sep = "";
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename A>
ostream &operator<<(ostream &os, const set<A> &s) {
  os << '{';
  string sep = "";
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &m) {
  os << '{';
  string sep = "";
  for (const auto &x : m)
    os << sep << x.first << " -> " << x.second, sep = ", ";
  return os << '}';
}
constexpr int inf = 0x3f3f3f3f;
constexpr int maxn = 1e5 + 10;
constexpr int mod = 1000000007;
int tam[maxn], last[maxn][2];
int main() {
  ios_base::sync_with_stdio(false), cout.tie(nullptr), cin.tie(nullptr);
  string s;
  cin >> s;
  int n = ((int)(s).size());
  reverse((s).begin(), (s).end());
  vector<string> ans;
  string here = "";
  bool remove = 0;
  memset(last, -1, sizeof(last));
  for (int i = 0; i < n; i++) {
    int cima = -1, baixo = -1;
    for (int j = 0; j < 26; j++) {
      if (j < s[i] - 'a') baixo = max(baixo, last[j][0]);
      if (j > s[i] - 'a') cima = max(cima, last[j][0]);
    }
    if (remove && last[s[i] - 'a'][0] == i - 1 && baixo >= cima) {
      remove = 0;
      here.pop_back();
      last[s[i] - 'a'][0] = last[s[i] - 'a'][1];
    } else {
      remove = 1;
      last[s[i] - 'a'][1] = last[s[i] - 'a'][0];
      last[s[i] - 'a'][0] = i;
      here.push_back(s[i]);
    }
    if (((int)(here).size()) <= 10) {
      reverse((here).begin(), (here).end());
      ans.push_back(here);
      tam[n - 1 - i] = ((int)(here).size());
      reverse((here).begin(), (here).end());
    } else {
      string massa = "";
      for (int p = ((int)(here).size()) - 1; p >= ((int)(here).size()) - 5; p--)
        massa.push_back(here[p]);
      massa += "...";
      for (int p = 1; p >= 0; p--) massa.push_back(here[p]);
      ans.push_back(massa);
      tam[n - 1 - i] = ((int)(here).size());
    }
  }
  reverse((ans).begin(), (ans).end());
  for (int i = 0; i < n; i++) cout << tam[i] << ' ' << ans[i] << '\n';
}
