#include <bits/stdc++.h>
using namespace std;
clock_t time_p = clock();
void time_taken() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
const long long mod = 1e9 + 7;
const long long INF = 1e18;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  string s;
  cin >> s;
  deque<char> q;
  int n = (int)(s).size();
  vector<string> ans(n);
  vector<int> res(n);
  bool fl = 1;
  vector<int> cnt(26);
  deque<char> foo;
  for (int i = n - 1; i >= 0; i--) {
    if (!q.empty() and q.front() == s[i] and fl) {
      if ((int)(foo).size() > 1) {
        if (foo[1] < s[i] and fl) {
          q.pop_front();
          if ((int)(q).size() == 0 or q.front() != foo.front()) foo.pop_front();
          fl = 0;
        } else {
          q.push_front(s[i]);
          if ((int)(foo).size() == 0 or foo.front() != s[i])
            foo.push_front(s[i]);
          fl = 1;
        }
      } else {
        q.pop_front();
        if ((int)(q).size() == 0 or q.front() != foo.front()) foo.pop_front();
        fl = 0;
      }
    } else {
      q.push_front(s[i]);
      if ((int)(foo).size() == 0 or foo.front() != s[i]) foo.push_front(s[i]);
      fl = 1;
    }
    res[i] = (int)(q).size();
    if ((int)(q).size() <= 10) {
      ans[i] = "";
      for (char c : q) {
        ans[i] += c;
      }
    } else {
      ans[i] = "";
      for (int j = 0; j < 5; j++) {
        ans[i] += q[j];
      }
      ans[i] += '.';
      ans[i] += '.';
      ans[i] += '.';
      for (int j = (int)(q).size() - 2; j <= (int)(q).size() - 1; j++) {
        ans[i] += q[j];
      }
    }
  }
  for (int i = 0; i < n; i++) cout << res[i] << ' ' << ans[i] << '\n';
  time_taken();
  return 0;
}
