A bracket sequence is a string, containing only characters "(", ")", "[" and "]".

A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()[]", "([])" are correct (the resulting expressions are: "(1)+[1]", "([1+1]+1)"), and "](" and "[" are not. The empty string is a correct bracket sequence by definition.

A substring *s*[*l*... *r*] (1 ≤ *l* ≤ *r* ≤ |*s*|) of string *s* = *s*<sub class="lower-index">1</sub>*s*<sub class="lower-index">2</sub>... *s*<sub class="lower-index">|*s*|</sub> (where |*s*| is the length of string *s*) is the string *s*<sub class="lower-index">*l*</sub>*s*<sub class="lower-index">*l* + 1</sub>... *s*<sub class="lower-index">*r*</sub>. The empty string is a substring of any string by definition.

You are given a bracket sequence, not necessarily correct. Find its substring which is a correct bracket sequence and contains as many opening square brackets «[» as possible.
The first and the only line contains the bracket sequence as a string, consisting only of characters "(", ")", "[" and "]". It is guaranteed that the string is non-empty and its length doesn't exceed 10<sup class="upper-index">5</sup> characters.
n = str(input())

st  = []

ans = 0
seq = ''
blocks = []

for i in range(len(n)):
    if n[i] == '(' or n[i] == '[':
        st.append((i,n[i]))

    elif n[i] == ')':
        if len(st) == 0:
            continue
        if st[-1][1] == '(':
            blocks.append((st[-1][0], i))
            st.pop()
        else:
            st = []

    elif n[i] == ']':
        if len(st) == 0:
            continue
        if st[-1][1] == '[':
            blocks.append((st[-1][0], i))
            st.pop()
        else:
            st = []

for i in range(len(blocks)):
    for j in range(len(blocks)):
        if j == i:
            continue

        if blocks[i][1] + 1 == blocks[j][0]:
            blocks.append((blocks[i][0], blocks[j][1]))
        elif blocks[i][0] == blocks[j][1] + 1:
            blocks.append((blocks[j][0], blocks[i][1]))

for block in blocks:
    sub = n[block[0]:block[1]+1]
    cnt = sub.count('[')
    if cnt > ans:
        ans = cnt
        seq = sub
    

print(blocks)

print(ans)
print(seq)  