#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = (long long)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
vector<long long> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
const long long MOD = 1000000007;
void solve() {
  string s;
  cin >> s;
  long long n = s.size();
  vector<pair<char, long long>> p;
  vector<pair<char, long long>> num;
  vector<string> ans;
  vector<long long> ans2;
  for (long long i = (long long)(s.size()) - 1; i >= 0; i--) {
    if (p.size() == 0) {
      p.emplace_back(s[i], i);
      num.emplace_back(s[i], 1);
    } else if (p.back().second != i + 1) {
      if (p.back().first == s[i])
        num.back().second++;
      else
        num.emplace_back(s[i], 1);
      p.emplace_back(s[i], i);
    } else {
      if (p.back().first != s[i]) {
        p.emplace_back(s[i], i);
        num.emplace_back(s[i], 1);
      } else {
        if (num.size() == 1) {
          p.pop_back();
          num.back().second--;
          if (num.back().second == 0) num.pop_back();
        } else {
          char cc = num[num.size() - 2].first;
          assert(cc != s[i]);
          if (cc > s[i]) {
            p.emplace_back(s[i], i);
            num.back().second++;
          } else {
            p.pop_back();
            num.back().second--;
            if (num.back().second == 0) num.pop_back();
          }
        }
      }
    }
    ans2.push_back(p.size());
    string t;
    if (p.size() <= 10) {
      for (long long i = (long long)(p.size()) - 1; i >= 0; i--) {
        t += p[i].first;
      }
    } else {
      for (long long i = 0; i < (long long)(5); i++) {
        t += p[p.size() - 1 - i].first;
      }
      t += "...";
      for (long long i = (long long)(2) - 1; i >= 0; i--) {
        t += p[i].first;
      }
    }
    ans.push_back(t);
  }
  reverse(ans.begin(), ans.end());
  reverse(ans2.begin(), ans2.end());
  for (long long i = 0; i < (long long)(ans.size()); i++) {
    cout << ans2[i] << " " << ans[i] << '\n';
  }
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  long long t = 1;
  while (t--) solve();
}
