#include <bits/stdc++.h>
using namespace std;
long long int const mod = 1000000007;
long long int power(long long int x, long long int y, long long int m) {
  long long int temp;
  if (y == 0) return 1;
  temp = power(x, y / 2, m) % m;
  if (y % 2 == 0)
    return ((temp) * (temp)) % m;
  else
    return (((x) % m) * ((temp * temp) % m)) % m;
}
vector<pair<char, int> > vec;
string fun() {
  string ans = "";
  if (vec.size() <= 10) {
    int ind = (int)vec.size() - 1;
    while (ind >= 0) ans += vec[ind].first, ind--;
  } else {
    int ind = (int)vec.size() - 1;
    int num = 5;
    while (num--) ans += vec[ind].first, ind--;
    ans += "...";
    ans += vec[1].first;
    ans += vec[0].first;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  for (int _ = 0; _ < (int)T; _++) {
    string second;
    cin >> second;
    int n = second.length();
    reverse(second.begin(), second.end());
    int flag = 0;
    char ch = '$';
    vector<pair<string, long long int> > ans;
    for (int i = 0; i < (int)n; i++) {
      if (i == 0) {
        vec.push_back({second[i], 0});
        string temp = fun();
        ans.push_back({temp, vec.size()});
        continue;
      }
      if (second[i] == second[i - 1]) {
        if (flag == 0) {
          vec.pop_back();
          string temp = fun();
          ans.push_back({temp, vec.size()});
          second[i] = '$';
        } else {
          vec.push_back({second[i], flag});
          string temp = fun();
          ans.push_back({temp, vec.size()});
        }
      } else {
        if (vec.size() &&
            (vec.back().first > second[i] ||
             (vec.back().first == second[i] && vec.back().second)))
          flag = 1;
        else
          flag = 0;
        vec.push_back({second[i], flag});
        string temp = fun();
        ans.push_back({temp, vec.size()});
      }
    }
    reverse(ans.begin(), ans.end());
    for (auto i : ans) {
      cout << i.second << " ";
      cout << i.first << "\n";
    }
  }
}
