#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  vector<pair<char, pair<int, int> > > go;
  int last = -1;
  int cnt = 0;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    if (last == -1) last = i;
    if (s[last] != s[i]) {
      go.push_back({s[last], {last, cnt}});
      last = i;
      cnt = 0;
    }
    cnt++;
  }
  go.push_back({s[last], {last, cnt}});
  int sz = go.size();
  vector<bool> del(sz, 0);
  char nex = 'a' - 1;
  char prev_nex = 'a' - 2;
  for (int i = sz - 1; i >= 0; i--) {
    if (go[i].second.second > 1) {
      if (go[i].first > nex)
        del[i] = 1;
      else if (go[i].first == nex && go[i].first > prev_nex)
        del[i] = 1;
    }
    if (go[i].second.second % 2 == 1 || del[i] == 0) {
      if (go[i].first != nex) prev_nex = nex;
      nex = go[i].first;
    }
  }
  vector<pair<char, pair<int, int> > > go2;
  for (int i = 0; i < sz; i++)
    if (del[i] == 0)
      go2.push_back(go[i]);
    else if (go[i].second.second % 2 == 1) {
      go2.push_back(go[i]);
      go2.back().second.second = 1;
    }
  int len = 0;
  for (auto x : go2) len += x.second.second;
  reverse(go.begin(), go.end());
  reverse(go2.begin(), go2.end());
  for (int i = 0; i < n; i++) {
    if (go.back().second.second == 0) go.pop_back();
    if (go2.size() > 0 && go2.back().second.first == i) {
      len -= go2.back().second.second;
      go2.pop_back();
    }
    int ans = len;
    if (del[sz - (int)go.size()] == 0)
      ans += go.back().second.second;
    else if (go.back().second.second % 2 == 1)
      ans++;
    cout << ans << ' ';
    string go3;
    if (ans <= 10) {
      if (del[sz - (int)go.size()] == 0)
        for (int v = 0; v < go.back().second.second; v++)
          go3 += go.back().first;
      else if (go.back().second.second % 2 == 1)
        go3 += go.back().first;
      for (int j = (int)go2.size() - 1; j >= 0; j--)
        for (int k = 0; k < go2[j].second.second; k++) go3 += go2[j].first;
    } else {
      if (del[sz - (int)go.size()] == 0)
        for (int v = 0; v < min(5, go.back().second.second); v++)
          go3 += go.back().first;
      else if (go.back().second.second % 2 == 1)
        go3 += go.back().first;
      if (go3.size() < 5) {
        for (int j = (int)go2.size() - 1; j >= 0; j--) {
          if (go3.size() == 5) break;
          int vv = min(5 - (int)go3.size(), go2[j].second.second);
          for (int v = 0; v < vv; v++) go3 += go2[j].first;
        }
      }
      for (int v = 0; v < 3; v++) go3 += '.';
      if (!go2.empty()) {
        if (go2.size() == 1 && go2[0].second.second == 1) {
          go3 += go.back().first;
          go3 += go2[0].first;
        } else if (go2[0].second.second == 1) {
          go3 += go2[1].first;
          go3 += go2[0].first;
        } else {
          go3 += go2[0].first;
          go3 += go2[0].first;
        }
      } else {
        go3 += go.back().first;
        go3 += go.back().first;
      }
    }
    cout << go3 << '\n';
    go.back().second.second--;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
