#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long min(long long a, long long b) { return (a < b) ? a : b; }
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long fp(long long a, long long b) {
  if (b == 0) return 1;
  long long x = fp(a, b / 2);
  x = (x * x) % mod;
  if (b & 1) x = (x * a) % mod;
  return x;
}
auto random_add = [] {
  char *p = new char;
  delete p;
  return uint64_t(p);
};
const uint64_t SEED =
    chrono::steady_clock::now().time_since_epoch().count() * (random_add() | 1);
mt19937_64 rng(SEED);
const long long N = 2e5 + 5;
deque<array<long long, 2>> q1;
set<array<long long, 2>> st;
void add(char ch, long long i) {
  st.insert({i, ch});
  if (q1.size() > 0 && q1.front()[0] == ch)
    q1.front()[1]++;
  else
    q1.push_front({ch, 1});
}
void solve() {
  vector<pair<long long, string>> ans;
  string s;
  cin >> s;
  for (long long i = s.size() - 1; i >= 0; i--) {
    if (st.size() > 0 && (*st.begin())[1] == s[i] &&
        (*st.begin())[0] == i + 1) {
      if (q1.size() == 1 || (q1[1][0] < s[i])) {
        q1[0][1]--;
        if (q1[0][1] == 0) q1.pop_front();
        st.erase(st.begin());
      } else
        add(s[i], i);
    } else {
      add(s[i], i);
    }
    string tmp;
    if (st.size() > 10) {
      auto it = st.begin();
      for (long long j = 1; j <= 5; j++) {
        tmp.push_back(char((*it)[1]));
        it++;
      }
      tmp += "...";
      auto it2 = st.rbegin();
      char ch = (*it2)[1];
      it2--;
      tmp += (*it2)[1];
      tmp += ch;
    } else {
      for (auto i : st) tmp.push_back(char(i[1]));
    }
    ans.push_back({st.size(), tmp});
  }
  reverse(ans.begin(), ans.end());
  for (auto i : ans) cout << i.first << " " << i.second << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(0));
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
}
