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.io.*;

import java.awt.geom.Point2D;
import java.text.*;
import java.math.*;
import java.util.*;

public class Main implements Runnable {

	final String filename = "";

	public void solve() throws Exception {
		String s = readword();
		int n = s.length();
		int[] left = new int[n];
		Arrays.fill(left, -1);
		int[] stack = new int[n];
		int sc = 0;
		int[] S = new int[n + 1];
		for (int i = 0; i < n; i++) {
			int d = s.charAt(i);
			if (d == '(' || d == '[') {
				stack[sc++] = i;
			} else {
				int pair = d == ')' ? '(' : '[';
				if (sc == 0 || s.charAt(stack[sc - 1]) != pair) {
					sc = 0;
				} else {
					int j = stack[sc - 1];
					if (j > 0 && left[j - 1] != -1)
						left[i] = left[j - 1];
					else
						left[i] = j;
					sc--;
				}
			}
		}
		int ans = 0, pos = 0, posr = 0;
		for (int i = 0; i < n; i++) {
			int d = s.charAt(i);
			if (d == '[')
				S[i + 1] = S[i] + 1;
			else
				S[i + 1] = S[i];

			if (left[i] != -1) {
				int r = S[i + 1] - S[left[i]];
				if (r > ans) {
					ans = r;
					pos = left[i];
					posr = i + 1;
				}
			}
		}
		out.write(ans + "\n");
		if (ans != 0) {
			out.write(s.substring(pos, posr) + "\n");
		}
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new BufferedWriter(new OutputStreamWriter(System.out));
			// in = new BufferedReader(new FileReader(filename+".in"));
			// out = new BufferedWriter(new FileWriter(filename+".out"));
			solve();
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	public int iread() throws Exception {
		return Integer.parseInt(readword());
	}

	public double dread() throws Exception {
		return Double.parseDouble(readword());
	}

	public long lread() throws Exception {
		return Long.parseLong(readword());
	}

	BufferedReader in;

	BufferedWriter out;

	public String readword() throws IOException {
		StringBuilder b = new StringBuilder();
		int c;
		c = in.read();
		while (c >= 0 && c <= ' ')
			c = in.read();
		if (c < 0)
			return "";
		while (c > ' ') {
			b.append((char) c);
			c = in.read();
		}
		return b.toString();
	}

	public static void main(String[] args) {
		try {
			Locale.setDefault(Locale.US);
		} catch (Exception e) {

		}
		// new Thread(new Main()).start();
		new Thread(null, new Main(), "1", 1 << 25).start();
	}
}