#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> v, w;
vector<pair<int, string> > ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> s;
  int lens = s.size();
  for (int i = lens - 1; i >= 0; i--) {
    if (!v.empty() && s[v.back()] == s[i] && v.back() == i + 1 &&
        (w.back() == -1 || s[i] > s[v[w.back()]])) {
      v.pop_back();
      w.pop_back();
    } else {
      if (v.empty())
        w.emplace_back(-1);
      else if (s[i] == s[v.back()])
        w.emplace_back(w.back());
      else
        w.emplace_back(v.size() - 1);
      v.emplace_back(i);
    }
    ans.emplace_back(make_pair(v.size(), ""));
    if (v.size() <= 10) {
      for (int i = v.size() - 1; i >= 0; i--) {
        ans.back().second.push_back(s[v[i]]);
      }
    } else {
      for (int i = v.size() - 1; i >= (int)v.size() - 5; i--)
        ans.back().second.push_back(s[v[i]]);
      ans.back().second = ans.back().second + "..." + s[v[1]] + s[v[0]];
    }
  }
  reverse(ans.begin(), ans.end());
  for (auto& v : ans) cout << v.first << " " << v.second << "\n";
  return 0;
}
