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 = s1s2... s|s| (where |s| is the length of string s) is the string slsl + 1... sr. 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.

Input

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 105 characters.

Output

In the first line print a single integer — the number of brackets «[» in the required bracket sequence. In the second line print the optimal sequence. If there are more than one optimal solutions print any of them.

Examples

Input

([])


Output

1
([])


Input

(((


Output

0
s=list(input())
st=[]
a=[0]*len(s)
for i in range(len(s)):
    if s[i]==']':
        if len(st)>0 and st[-1][0]=='[':
            a[st[-1][1]]=i
            st.pop()
        else:
            st=[]
    elif s[i]==')':
        if len(st)>0 and st[-1][0]=='(':
            a[st[-1][1]]=i
            st.pop()
        else:
            st=[]
    else:
        st.append([s[i],i])

mans=0
ml=0
mr=0



def kkk(s,l,r):
    ans=0
    for i in range(l,r+1):
        if s[i]=='[':
            ans+=1
    return ans
        
i=0
while i<len(s):
    while i<len(s) and a[i]==0: i+=1
    if i<len(s):
        l=i
        r=a[i]
        while r+1<len(s) and a[r+1]>0: r=a[r+1]
        t=kkk(s,l,r)
        if t>mans:
            mans=t
            ml=l
            mr=r
        i=r+1

print(mans)
if mans>0:
    for i in range(ml,mr+1):
        print(s[i],end='')
