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
#include <bits/stdc++.h>
using namespace std;
struct block {
  int size, start, end;
  block(int s, int ss, int e) {
    size = s;
    start = ss;
    end = e;
  }
};
stack<pair<int, int> > S;
vector<block> Block;
string s;
int St[1000010], ans, st;
void SetEndPoints(string s) {
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '[') S.push(make_pair(i, 1));
    if (s[i] == '(') S.push(make_pair(i, 0));
    if (s[i] == ']' && !S.empty())
      if (!S.top().second)
        while (!S.empty()) S.pop();
      else {
        if (St[S.top().first - 1])
          St[i] = St[S.top().first - 1];
        else
          St[i] = S.top().first + 1;
        S.pop();
      }
    if (s[i] == ')' && !S.empty())
      if (S.top().second)
        while (!S.empty()) S.pop();
      else {
        if (St[S.top().first - 1])
          St[i] = St[S.top().first - 1];
        else
          St[i] = S.top().first + 1;
        S.pop();
      }
  }
}
int BestBlock(string s) {
  for (int i = s.size() - 1; i >= 0; i--)
    if (St[i]) {
      Block.push_back(block(0, St[i] - 1, i));
      i = St[i];
    }
  int Pointer = -1, BestSize = 0;
  for (int i = 0; i < Block.size(); i++) {
    for (int j = Block[i].start; j <= Block[i].end; j++)
      if (s[j] == ']') Block[i].size++;
    if (Block[i].size > BestSize) {
      Pointer = i;
      BestSize = Block[i].size;
    }
  }
  return Pointer;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> s;
  SetEndPoints(s);
  int BB = BestBlock(s);
  if (BB == -1)
    cout << 0 << endl;
  else {
    cout << Block[BB].size << endl;
    for (int i = Block[BB].start; i <= Block[BB].end; i++) cout << s[i];
  }
  cout << endl;
}
