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;
class classcomp {
 public:
  bool operator()(const int& l, const int& r) const { return l < r; }
};
struct node {
  char c;
  int in, cnt;
};
int main() {
  char s[100010];
  int i, j, k, l, m, n;
  scanf("%s", s);
  vector<pair<char, pair<int, int> > > a;
  a.push_back(make_pair('0', make_pair(-1, 0)));
  l = strlen(s);
  int ans = 0;
  int st = -1, en = -1;
  for (i = 0; i < l; i++) {
    if (a.empty() || (s[i] == '[' || s[i] == '(')) {
      a.push_back(make_pair(s[i], make_pair(i, 0)));
    } else if (s[i] == ')' || s[i] == ']') {
      if (a.back().first == '[' && s[i] == ']') {
        k = a.back().second.second;
        k++;
        a.pop_back();
        a.back().second.second += k;
      } else if (a.back().first == '(' && s[i] == ')') {
        k = a.back().second.second;
        a.pop_back();
        a.back().second.second += k;
      } else {
        a.clear();
        a.push_back(make_pair('0', make_pair(i, 0)));
        continue;
      }
    }
    if (ans <= a.back().second.second) {
      ans = a.back().second.second;
      st = a.back().second.first + 1;
      en = i;
    }
  }
  printf("%d\n", ans);
  if (ans == 0) {
    printf("\n");
  } else {
    for (i = st; i <= en; i++) printf("%c", s[i]);
    printf("\n");
  }
  return 0;
}
