#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double pii = 2 * pi;
const double eps = 1e-6;
const long long MOD = 1e9 + 7;
string f(vector<int>& ind, string& s) {
  string ans = "";
  if (ind.size() > 10) {
    for (int i = 1; i <= 5; i++) ans.push_back(s[ind[ind.size() - i]]);
    ans.push_back('.');
    ans.push_back('.');
    ans.push_back('.');
    ans.push_back(s[ind[1]]);
    ans.push_back(s[ind[0]]);
  } else {
    for (int i = ind.size() - 1; i >= 0; i--) ans.push_back(s[ind[i]]);
  }
  return ans;
}
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  vector<pair<int, string>> ans;
  vector<int> st;
  vector<int> notme;
  for (int i = n - 1; i >= 0; i--) {
    if (st.size() == 0) {
      st.push_back(i);
      notme.push_back(-1);
    } else {
      if (st.back() == i + 1 && s[i] == s[i + 1]) {
        int xx = notme.back();
        if (xx != -1 && s[xx] > s[i]) {
          st.push_back(i);
          notme.push_back(xx);
        } else {
          st.pop_back();
          notme.pop_back();
        }
      } else {
        int xx = -1;
        if (s[st.back()] == s[i])
          xx = notme.back();
        else
          xx = st.back();
        st.push_back(i);
        notme.push_back(xx);
      }
    }
    ans.push_back({int(st.size()), f(st, s)});
  }
  for (int i = ans.size() - 1; i >= 0; i--) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  solve();
  return 0;
}
