#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1};
int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2};
int ky8[] = {2, -2, 1, -1, 2, -2, 1, -1};
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2);
  x = x * x;
  if (b % 2 == 1) x = x * a;
  return x;
}
long long bigmod(long long a, long long b, long long c) {
  if (b == 0) return 1 % c;
  long long x = bigmod(a, b / 2, c);
  x = x * x % c;
  if (b % 2 == 1) x = x * a % c;
  return x;
}
long long mod_inverse(long long a, long long mod) {
  return bigmod(a, mod - 2, mod);
}
string s, p;
string ans[100005];
int res[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  p.push_back('0');
  int n = s.size();
  int sz = 1;
  set<int> st[300];
  for (int i = 0; i < (300); i++) st[i].insert(n);
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] != p.back()) {
      p.push_back(s[i]);
      sz++;
      st[s[i]].insert(i);
    } else {
      int val = *st[s[i]].begin();
      if (val == i + 1) {
        p.pop_back();
        sz--;
        st[s[i]].erase(st[s[i]].find(val));
        int mn = n, ch = 0;
        for (int j = 'a'; j <= 'z'; j++) {
          if (j == s[i]) continue;
          int val = *st[j].begin();
          if (val < mn) {
            mn = val;
            ch = j;
          }
        }
        if (ch > s[i]) {
          p.push_back(s[i]);
          p.push_back(s[i]);
          st[s[i]].insert(i);
          st[s[i]].insert(i + 1);
          sz += 2;
        }
      } else {
        st[s[i]].insert(i);
        p.push_back(s[i]);
        sz += 1;
      }
    }
    res[i] = sz - 1;
    if (sz <= 11) {
      for (int j = sz - 1; j > 0; j--) {
        ans[i].push_back(p[j]);
      }
    } else {
      for (int j = sz - 1, k = 0; k < 5; j--, k++) {
        ans[i].push_back(p[j]);
      }
      ans[i] += "...";
      ans[i].push_back(p[2]);
      ans[i].push_back(p[1]);
    }
  }
  for (int i = 0; i < (n); i++) cout << res[i] << " " << ans[i] << endl;
  return 0;
}
