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
import java.util.*;
import java.math.*;
import java.io.*;

public class Main
	{
	public static void main(String args[]) throws IOException
		{
		BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
		String s=c.readLine();
		char A[]=s.toCharArray();
		int N=A.length;
		int CP[]=new int[N];			//location of the closing brace
		for(int i=0;i<N;i++)
			CP[i]=-1;
		Stack<node> S=new Stack<node>();
		S.push(new node(A[0],0));
		for(int i=1;i<N;i++)
			{
			if(S.isEmpty())
				{
				S.push(new node(A[i],i));
				continue;
				}
			node top=S.peek();
			if((top.c=='('&&A[i]==')')||(top.c=='['&&A[i]==']'))
				{
				CP[i]=top.loc;
				S.pop();
				}
			else
				S.push(new node(A[i],i));
			}
		for(int i=0;i<N;i++)
			{
			if(CP[i]>0)
				{
				if(CP[CP[i]-1]!=-1)
					CP[i]=CP[CP[i]-1];
				}
			}
		//System.out.println(Arrays.toString(CP));
		int OB[]=new int[N];
		if(A[0]=='[')
			OB[0]=1;
		for(int i=1;i<N;i++)
			{
			if(A[i]=='[')
				OB[i]=1+OB[i-1];
			else
				OB[i]=OB[i-1];
			}
		//System.out.println(Arrays.toString(OB));
		int max=0;
		int maxIndex=-1;
		for(int i=0;i<N;i++)
			{
			if(CP[i]==-1)
				continue;
			else
				{
				int openingBraces;
				if(CP[i]!=0)
					openingBraces=OB[i]-OB[CP[i]-1];
				else
					openingBraces=OB[i];
				if(openingBraces>max)
					{
					max=openingBraces;
					maxIndex=i;
					}
				}
			}
		System.out.println(max);
		if(max>0)
			{
			System.out.println(s.substring(CP[maxIndex],maxIndex+1));
			}
		}
	}
class node
	{
	char c;
	int loc;
	public node(char c, int loc)
		{
		this.c=c;
		this.loc=loc;
		}
	}

//must declare new classes here