#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long LINF = 0x3f3f3f3f3f3f3f3f;   const int MOD = 1e9 + 7;   int dir[8][2] = {-1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -1, 1, 1, -1, 1, 1};   template <typename S, typename T>   ostream &operator<<(ostream &os, const pair<S, T> x) {     os <<  (  << x.first <<  ,   << x.second <<  ) ;     return os;   }   template <typename S, typename T>   inline bool Min(S &a, const T &b) {     return a > b ? a = b, true : false;   }   template <typename S, typename T>   inline bool Max(S &a, const T &b) {     return a < b ? a = b, true : false;   }   template <typename S, typename T>   inline void Adm(S &a, const T &b) {     a = (a + b) % MOD;     if (a < 0) a += MOD;   }   template <typename T>   inline bool IsPri(T x) {     if (x < 2) return false;     for (T i = 2; i * i <= x; ++i)       if (x % i == 0) return false;     return true;   }   template <typename T>   inline T _Gcd(T a, T b) {     while (b) {       T t = b;       b = a % b;       a = t;     }     return a;   }   template <typename T>   inline int _BitCnt(T x) {     int cnt = 0;     while (x) ++cnt, x &= x - 1;     return cnt;   }   inline long long Pow(long long a, long long n) {     long long t = 1;     a %= MOD;     while (n > 0) {       if (n & 1) t = t * a % MOD;       a = a * a % MOD, n >>= 1;     }     return t % MOD;   }   inline int read() {     static char buf[1000000], *p1 = buf, *p2 = buf;     register int x = false;     register char ch =         p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)             ? EOF             : *p1++;     ;     register bool sgn = false;     while (ch !=  -  && (ch <  0  || ch >  9 ))       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     if (ch ==  - )       sgn = true,       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     while (ch >=  0  && ch <=  9 )       x = (x << 1) + (x << 3) + (ch ^ 48),       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     return sgn ? -x : x;   }   const int N = 1e5 + 100;   char s[N];   int main() {     scanf( %s , s);     int n = strlen(s);     string str, ss;     vector<int> pos;     stack<pair<int, string>> stk;     for (int i = n - 1; i >= 0; --i) {       char c = s[i];       if (str.empty() || str.back() != c || pos.back() - i > 1) {         str.push_back(c), pos.push_back(i);         if (ss.empty() || ss.back() != c) ss.push_back(c);       } else {         if (((int)(ss).size()) == 1 || ss[((int)(ss).size()) - 2] < c) {           str.pop_back(), pos.pop_back();           if (str.empty() || str.back() != ss.back()) ss.pop_back();         } else {           str.push_back(c), pos.push_back(i);           if (ss.empty() || ss.back() != c) ss.push_back(c);         }       }       pair<int, string> now = {((int)(str).size()),   };       if (((int)(str).size()) <= 10)         now.second = str;       else         now.second =             str.substr(0, 2) +  ...  + str.substr(((int)(str).size()) - 5, 5);       reverse((now.second).begin(), (now.second).end());       stk.push(now);     }     while (!stk.empty())       printf( %d %s n , stk.top().first, stk.top().second.c_str()), stk.pop();     return 0;   }