#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const char dir[] = {'R', 'L', 'D', 'U'};
ll add(ll a, ll b) {
  a += b;
  if (a >= MOD) {
    a -= MOD;
  }
  return a;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) a += MOD;
  return a;
}
int mult(int a, int b) { return ((ll)a * b) % MOD; }
void setIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
int main() {
  setIO();
  string s;
  cin >> s;
  int n = s.length();
  int last = -1;
  int before = -1;
  vector<int> ans;
  vector<string> print(n);
  vector<int> len(n);
  bool canSame[n];
  int ld[n + 1];
  ld[n] = -1;
  int lastdiff = -1;
  fill(canSame, canSame + n, 0);
  for (int i = n - 1; i >= 0; --i) {
    int cur = s[i] - 'a';
    if (cur == last &&
        (cur > before || (cur == before && canSame[i + 1] && cur > lastdiff)) &&
        ans.size()) {
      ans.pop_back();
      last = before;
      lastdiff = ld[i + 2];
      before = 1e9;
    } else {
      ans.emplace_back(cur);
      if (before == 1e9) canSame[i] = true;
      if (cur != last) lastdiff = last;
      before = last;
      last = cur;
    }
    ld[i] = lastdiff;
    len[i] = ans.size();
    if (ans.size() <= 10) {
      for (int j = ans.size() - 1; j >= 0; --j) {
        print[i] += (char)(ans[j] + 'a');
      }
    } else {
      for (int j = ans.size() - 1; j >= ans.size() - 5; --j) {
        print[i] += (char)(ans[j] + 'a');
      }
      print[i] += "...";
      for (int j = 1; j >= 0; --j) {
        print[i] += (char)(ans[j] + 'a');
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << len[i] << " " << print[i] << "\n";
  }
}
