Some time ago Lesha found an entertaining string $s$ consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows.

Lesha chooses an arbitrary (possibly zero) number of pairs on positions $(i, i + 1)$ in such a way that the following conditions are satisfied:   for each pair $(i, i + 1)$ the inequality $0 \le i < |s| - 1$ holds;  for each pair $(i, i + 1)$ the equality $s_i = s_{i + 1}$ holds;  there is no index that is contained in more than one pair.  After that Lesha removes all characters on indexes contained in these pairs and the algorithm is over. 

Lesha is interested in the lexicographically smallest strings he can obtain by applying the algorithm to the suffixes of the given string.


-----Input-----

The only line contains the string $s$ ($1 \le |s| \le 10^5$) — the initial string consisting of lowercase English letters only.


-----Output-----

In $|s|$ lines print the lengths of the answers and the answers themselves, starting with the answer for the longest suffix. The output can be large, so, when some answer is longer than $10$ characters, instead print the first $5$ characters, then "...", then the last $2$ characters of the answer.


-----Examples-----
Input
abcdd

Output
3 abc
2 bc
1 c
0 
1 d

Input
abbcdddeaaffdfouurtytwoo

Output
18 abbcd...tw
17 bbcdd...tw
16 bcddd...tw
15 cddde...tw
14 dddea...tw
13 ddeaa...tw
12 deaad...tw
11 eaadf...tw
10 aadfortytw
9 adfortytw
8 dfortytw
9 fdfortytw
8 dfortytw
7 fortytw
6 ortytw
5 rtytw
6 urtytw
5 rtytw
4 tytw
3 ytw
2 tw
1 w
0 
1 o



-----Note-----

Consider the first example.

  The longest suffix is the whole string "abcdd". Choosing one pair $(4, 5)$, Lesha obtains "abc".  The next longest suffix is "bcdd". Choosing one pair $(3, 4)$, we obtain "bc".  The next longest suffix is "cdd". Choosing one pair $(2, 3)$, we obtain "c".  The next longest suffix is "dd". Choosing one pair $(1, 2)$, we obtain "" (an empty string).  The last suffix is the string "d". No pair can be chosen, so the answer is "d". 

In the second example, for the longest suffix "abbcdddeaaffdfouurtytwoo" choose three pairs $(11, 12)$, $(16, 17)$, $(23, 24)$ and we obtain "abbcdddeaadfortytw"

Difficulty: interview

Starter code:

Solutions:
import sys
s = input().strip()
N = len(s)
if len(s) == 1:
    print(1, s[0])
    return
X = [s[-1], s[-2]+s[-1] if s[-2]!=s[-1] else ""]
Y = [1, 2 if s[-2]!=s[-1] else 0]
for i in range(N-3, -1, -1):
    c = s[i]
    k1 = c+X[-1]
    ng = Y[-1]+1
    if ng > 10:
        k1 = k1[:5] + "..." + k1[-2:]
    if c == s[i+1] and k1 > X[-2]:
        k1 = X[-2]
        ng = Y[-2]
    X.append(k1)
    Y.append(ng)
for i in range(N-1, -1, -1):
    print(Y[i], X[i])


import sys
s = input().strip()
N = len(s)
if len(s) == 1:
    print(1, s[0])
    return
X = [s[-1], s[-2]+s[-1] if s[-2]!=s[-1] else ""]
Y = [1, 2 if s[-2]!=s[-1] else 0]
for i in range(N-3, -1, -1):
    c = s[i]
    k1 = c+X[-1]
    ng = Y[-1]+1
    if ng > 10:
        k1 = k1[:5] + "..." + k1[-2:]
    if c == s[i+1] and k1 > X[-2]:
        k1 = X[-2]
        ng = Y[-2]
    X.append(k1)
    Y.append(ng)
for i in range(N-1, -1, -1):
    print(Y[i], X[i])

s = input().strip();N = len(s)
if len(s) == 1:print(1, s[0]);return
X = [s[-1], s[-2]+s[-1] if s[-2]!=s[-1] else ""];Y = [1, 2 if s[-2]!=s[-1] else 0]
for i in range(N-3, -1, -1):
    c = s[i];k1 = c+X[-1];ng = Y[-1]+1
    if ng > 10:k1 = k1[:5] + "..." + k1[-2:]
    if c == s[i+1] and k1 > X[-2]:k1 = X[-2];ng = Y[-2]
    X.append(k1);Y.append(ng)
for i in range(N-1, -1, -1):print(Y[i], X[i])

import sys
z=sys.stdin.readline
s=z().strip()
l=len(s)
b=[' ']
o=[]
m=[' ']
for i in range(l):
 c=s[-1-i]
 if c==b[-1]:
  if c>m[-1].lower() or (c==m[-1].lower() and c>m[-2].lower()):
   b.pop()
   if b[-1].lower()!=m[-1].lower():m.pop()
   b[-1]=b[-1].upper()
   m[-1]=m[-1].upper()
  else:b+=[c]
 else:
  b+=[c]
  if b[-1]!=m[-1].lower():m+=[b[-1]]
 if len(b)>11:o+=[(str(len(b)-1)+' '+''.join(b[:-6:-1])+'...'+b[2]+b[1]).lower()]
 elif len(b)>1:o+=[(str(len(b)-1)+' '+''.join(b[-1::-1])).lower()]
 else:o.append('0')
print('\n'.join(o[::-1]))

s = input()
n = len(s)
res = ['',s[-1]]
l = [1]
flag = True
last = ['']
for i in range(n-2,-1,-1):
    tmp = res[-1]
    if flag and s[i]==tmp[0] and s[i]>last[-1]:
        res.append(res[-2])
        l.append(l[-1]-1)
        flag = False
        if l[-1]>0 and res[-1][0]!=s[i]:
            last.pop()
    else:
        l.append(l[-1]+1)
        tmp = s[i]+tmp
        flag = True
        if len(tmp)>10:
            res.append(tmp[:5]+'...'+tmp[-2:])
        else:
            res.append(tmp)
        if len(res[-1])>1 and res[-1][0]!=res[-1][1]:
            last.append(res[-1][1])
res.pop(0)
for i in range(n-1,-1,-1):
    print(l[i],res[i])


import os
import sys
import io
import functools
 
import copy
import math
# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline # 神奇快读，无法运行调试
GANS = []
 
# def print(*args): # 神奇快写，最后得写上os.write
#     nonlocal GANS
#     for i in args:
#         GANS.append(f'{i}'.encode())
 
def cmp(x,y):
    if x[1]==y[1]:
        return -(y[0]-x[0])
    return -(x[1]-y[1])
 
 
s = input()
 
ans = []
 
# s = s[::-1]
 
cur = []
ctr = []
pos = []
pv = [chr(0)]

pvc = chr(1)
for p,i in enumerate(s[::-1]):
    if cur and cur[-1] == i:
        f = True
        if len(cur)>=2:
            if cur[-2] > i:
                f = False
            elif cur[-2]==i:
                if  pos[-2]==p-2:
                        f=False
                if pv[-1]>=i:
                    f = False
                # elif len(cur)>=3:
                #     if cur[-3]>=i:
                #         f = False
        if f and p==pos[-1]+1:
            cur.pop()
            pos.pop()
            pv.pop()
            pvc = pv[-1]

        else:
            cur.append(i)
            pos.append(p)
            pv.append(pvc)
    else:
        if cur:pvc = cur[-1]
        cur.append(i)
        pos.append(p)
        pv.append(pvc)
    ctr.append(len(cur))
    if ctr[-1] > 10:
        ans.append(''.join(cur[-5:][::-1])+'...'+''.join(cur[:2][::-1]))
    else:
        ans.append(''.join(cur[::-1]))
 
for i in range(len(ans)):
    print(ctr[-i-1],ans[-i-1])
    # print()
    # print(len(i),end=' ')
    # if len(i)>10:
    #     print(i[:5]+'...'+i[-2:])
    # else:
    #     print(i)


s = input()
cs = ['']
ans = []
last  = ['']
poped = False
for c in s[::-1]:
    if not poped and c == cs[-1] and c > last[-2]:
        cs.pop()
        if (not cs) or c != cs[-1]:
            last.pop()
        poped = True
    else:
        poped = False
        if c != cs[-1]:
            last.append(c)
        cs.append(c)
    if len(cs) <= 11:
        ans.append((len(cs) - 1, ''.join(cs[::-1])))
    else:
        ans.append((len(cs) - 1, (''.join(cs[:3]) + '...' + ''.join(cs[-5:]))[::-1]))

for a, b in ans[::-1]:
    print(a, b)


def main(s):
    if len(s) == 0:
        return []
    if len(s) == 1:
        return [[s], [1]]
    s = s[::-1]
    sres = [s[0]]
    nres = [1]
    if s[0] == s[1]:
        sres.append('')
        nres.append(0)
    else:
        sres.append(s[1] + s[0])
        nres.append(2)
    for i in range(2, len(s)):
        st = s[i] + sres[-1]
        nt = nres[-1] + 1
        if nt > 10:
            st = st[:5] + '...' + st[-2:]
        if s[i] == s[i-1] and st > sres[-1]:
            st = sres[-2]
            nt = nres[-2]
        sres.append(st)
        nres.append(nt)
    return [sres, nres]


s = input()
sres, nres = main(s)

for i in range(len(s)-1, -1, -1):
    print(nres[i], sres[i])