#include <bits/stdc++.h>   using namespace std;   int n;   string s;   struct str {     int len;     bool vis;     string pre, suf;     void push_front(char ch) {       if (!len)         vis = 0;       else if (ch ^ pre[0])         vis = ch < pre[0];       pre = ch + pre;       if (len < 2)         suf = ch + suf;       else if (pre.length() > 10)         pre.pop_back();       len++;     }   } ans[100005];   int main() {     int i;     cin >> s;     n = s.length();     ans[n].len = ans[n].vis = 0;     ans[n].pre = ans[n].suf =   ;     s +=  # ;     for (i = n - 1; i >= 0; i--)       if (s[i] ^ s[i + 1])         ans[i] = ans[i + 1], ans[i].push_front(s[i]);       else {         ans[i] = ans[i + 2];         if (s[i] < ans[i].pre[0] || s[i] == ans[i].pre[0] && ans[i].vis) {           ans[i].push_front(s[i]);           ans[i].push_front(s[i]);         }       }     for (i = 0; i < n; i++) {       cout << ans[i].len <<    ;       if (ans[i].len <= 10)         cout << ans[i].pre << endl;       else         cout << ans[i].pre.substr(0, 5) <<  ...  << ans[i].suf << endl;     }     return 0;   }   