#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5;
long long mn[maxn];
string s;
long long id;
vector<pair<long long, string>> ans;
long long lastnot[26];
long long sz[maxn];
string get(long long ind, long long maxsize = 1000000) {
  if (ind == s.size() || mn[ind] == id) return "";
  ind = mn[ind];
  string p = "";
  while (mn[ind] != id) {
    p.push_back(s[ind]);
    maxsize--;
    if (maxsize == 0) return p;
    ind = mn[ind + 1];
  }
  return p;
}
void print(long long id1, string ss) { ans[id1].second = ss; }
long long getsz(long long ind) {
  if (ind == s.size() || mn[ind] == id) return 0;
  return sz[mn[ind]];
}
signed main() {
  cin.tie();
  cout.tie();
  ios_base::sync_with_stdio(false);
  cin >> s;
  for (long long l = 0; l < s.size(); ++l) {
    ans.push_back({0, ""});
  }
  for (long long m = 0; m < 26; ++m) {
    lastnot[m] = -1;
  }
  long long last = s[s.size() - 1];
  long long cnt = 1;
  string go = "";
  go.push_back(s[s.size() - 1]);
  ans[s.size() - 1].first = 1;
  print(s.size() - 1, go);
  go = "";
  id = s.size();
  mn[s.size() - 1] = s.size();
  sz[s.size() - 1] = 0;
  for (long long i = (long long)s.size() - 2; i >= 0; --i) {
    if (last != s[i]) {
      if (cnt % 2 == 1) {
        mn[i + 1] = i + 1;
        sz[i + 1] = 0;
        string h = get(i + 2);
        id = i + 1;
        for (long long j = (long long)h.size() - 1; j >= 0; --j) {
          go.push_back(h[j]);
          for (long long k = 0; k < 26; ++k) {
            if (k != h[j] - 'a') lastnot[k] = h[j] - 'a';
          }
        }
        go.push_back(s[i + 1]);
        for (long long k = 0; k < 26; ++k) {
          if (k != s[i + 1] - 'a') lastnot[k] = s[i + 1] - 'a';
        }
      }
      cnt = 1;
    } else {
      cnt++;
    }
    if (s[i] - 'a' == s[id] - 'a') {
      if (lastnot[s[i] - 'a'] > s[i] - 'a') {
        if (mn[i + 1] != s.size() && s[mn[i + 1]] >= s[i]) {
          mn[i] = i;
          if (mn[i + 1] < s.size())
            sz[i] = sz[mn[i + 1]] + 1;
          else
            sz[i] = 1;
        } else {
          mn[i] = mn[i + 1];
          if (mn[i + 1] < s.size())
            sz[i] = sz[mn[i + 1]] + 1;
          else
            sz[i] = 1;
        }
      } else {
        mn[i] = mn[i + 1];
        if (mn[i + 1] < s.size())
          sz[i] = sz[mn[i + 1]] + 1;
        else
          sz[i] = 1;
      }
    } else {
      if (mn[i + 1] != s.size() && s[mn[i + 1]] >= s[i]) {
        mn[i] = i;
        if (mn[i + 1] < s.size())
          sz[i] = sz[mn[i + 1]] + 1;
        else
          sz[i] = 1;
      } else {
        mn[i] = mn[i + 1];
        if (mn[i + 1] < s.size())
          sz[i] = sz[mn[i + 1]] + 1;
        else
          sz[i] = 1;
      }
    }
    if (cnt % 2 == 1) {
      long long sz1 = 1 + getsz(i + 1) + go.size();
      ans[i].first = sz1;
      if (sz1 > 10) {
        string y = s[i] + get(i + 1, 4);
        long long o = 0;
        while (y.size() != 5) {
          y.push_back(go[go.size() - 1 - o]);
          o++;
        }
        y.push_back('.');
        y.push_back('.');
        y.push_back('.');
        if (go.size() < 2) {
          long long l = i;
          long long r = id;
          while (l + 1 < r) {
            long long m = (l + r) / 2;
            long long yy = getsz(m);
            if (yy > 2) {
              l = m;
            } else {
              r = m;
            }
          }
          string oo = get(r, 2);
          long long l1 = 2 - go.size();
          for (long long j = 0; j < l1; ++j) {
            y.push_back(oo[oo.size() - 1 - j]);
          }
          for (long long k = go.size() - 1; k >= 0; --k) {
            y.push_back(go[k]);
          }
        } else {
          y.push_back(go[1]);
          y.push_back(go[0]);
        }
        print(i, y);
      } else {
        string y = go;
        reverse(y.begin(), y.end());
        y = s[i] + get(i + 1) + y;
        print(i, y);
      }
    } else {
      long long sz1 = 0 + getsz(i) + go.size();
      ans[i].first = sz1;
      if (sz1 > 10) {
        string y = get(i, 5);
        long long o = 0;
        while (y.size() != 5) {
          y.push_back(go[go.size() - 1 - o]);
          o++;
        }
        y.push_back('.');
        y.push_back('.');
        y.push_back('.');
        if (go.size() < 2) {
          long long l = i - 1;
          long long r = id;
          while (l + 1 < r) {
            long long m = (l + r) / 2;
            long long yy = getsz(m);
            if (yy > 2) {
              l = m;
            } else {
              r = m;
            }
          }
          string oo = get(r, 2);
          long long l1 = 2 - go.size();
          for (long long j = 0; j < l1; ++j) {
            y.push_back(oo[oo.size() - 1 - j]);
          }
          for (long long k = go.size() - 1; k >= 0; --k) {
            y.push_back(go[k]);
          }
        } else {
          y.push_back(go[1]);
          y.push_back(go[0]);
        }
        print(i, y);
      } else {
        string y = go;
        reverse(y.begin(), y.end());
        y = get(i) + y;
        print(i, y);
      }
    }
    last = s[i];
  }
  for (long long k = 0; k < ans.size(); ++k) {
    cout << ans[k].first << " " << ans[k].second << "\n";
  }
}
