#include <bits/stdc++.h>
using namespace std;
const long long M = 1e5 + 10, M2 = 2e6 + 10, oo = 1e9 + 7;
int res[M], al[M];
string s, ans[M];
void solve() {
  int n;
  cin >> s;
  int ln = 0;
  int front = -1, nextimp = -1;
  n = s.length();
  for (int i = n - 1; i >= 0; i--) {
    char c = s[i];
    if (front == -1) {
      res[ln] = i;
      front = i;
      ln++;
    } else if (c == s[front]) {
      if ((nextimp == -1 || s[res[nextimp]] < c) && front == i + 1) {
        ln--;
        if (ln == 0)
          front = -1;
        else
          front = res[ln - 1];
        while (nextimp >= 0 && s[front] == s[res[nextimp]]) nextimp--;
      } else {
        res[ln] = i;
        front = i;
        ln++;
      }
    } else {
      res[ln] = i;
      nextimp = ln - 1;
      front = i;
      ln++;
    }
    string ns = "";
    if (ln > 10) {
      for (int j = ln - 1; j > ln - 6; j--) ns += s[res[j]];
      ns += "...";
      ns += s[res[1]];
      ns += s[res[0]];
    } else {
      for (int j = ln - 1; j >= 0; j--) ns += s[res[j]];
    }
    ans[i] = ns;
    al[i] = ln;
  }
  for (int i = 0; i < n; i++) cout << al[i] << " " << ans[i] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
