#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
const int MM = 998244353;
const long double PI = acos(-1);
long long power(long long b, long long e, long long m) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b % m, e / 2, m) % m;
  return power(b * b % m, e / 2, m);
}
long long power(long long b, long long e) {
  if (e == 0) return 1;
  if (e & 1) return b * power(b * b, e / 2);
  return power(b * b, e / 2);
}
template <typename T, typename U>
static inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
static inline void amax(T &x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  return os << '(' << p.first << "," << p.second << ')';
}
int _runtimeTerror_() {
  string s;
  cin >> s;
  int n = (long long)s.size();
  vector<char> v;
  vector<pair<char, int>> u;
  vector<int> idx;
  char last = 0;
  vector<pair<int, string>> ans;
  u.push_back({0, 1});
  for (int i = n - 1; i >= 0; --i) {
    if (!v.empty() && v.back() == s[i] && u.size() >= 2 &&
        (u[(long long)u.size() - 2].first < s[i]) && idx.back() == i + 1) {
      v.pop_back();
      idx.pop_back();
      if (u.back().second == 1)
        u.pop_back();
      else
        --u.back().second;
    } else {
      v.push_back(s[i]);
      idx.push_back(i);
      if (u.empty() || u.back().first != s[i])
        u.push_back({s[i], 1});
      else
        ++u.back().second;
    }
    int u = (long long)v.size();
    string l;
    if (u <= 10) {
      for (auto &j : v) l.push_back(j);
      reverse(l.begin(), l.end());
    } else {
      for (int i = 0; i < 5; ++i) l.push_back(v[u - 1 - i]);
      l += "...";
      l.push_back(v[1]);
      l.push_back(v[0]);
    }
    ans.push_back({u, l});
  }
  reverse(ans.begin(), ans.end());
  for (auto &j : ans) cout << j.first << " " << j.second << "\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) _runtimeTerror_();
  return 0;
}
