Problem: An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code 091), a colon (ASCII code 058), some (possibly zero) vertical line characters (ASCII code 124), another colon, and a closing bracket (ASCII code 093). The length of the accordion is the number of characters in it.

For example, [::], [:||:] and [:|||:] are accordions having length 4, 6 and 7. (:|:), {:||:}, [:], ]:||:[ are not accordions. 

You are given a string s. You want to transform it into an accordion by removing some (possibly zero) characters from it. Note that you may not insert new characters or reorder existing ones. Is it possible to obtain an accordion by removing characters from s, and if so, what is the maximum possible length of the result?

Input

The only line contains one string s (1 ≤ |s| ≤ 500000). It consists of lowercase Latin letters and characters [, ], : and |.

Output

If it is not possible to obtain an accordion by removing some characters from s, print -1. Otherwise print maximum possible length of the resulting accordion.

Examples

Input


|[a:b:|]


Output


4


Input


|]:[|:]


Output


-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 4;
string str, ans, rafi;
map<string, string> maap;
vector<int> circle;
ll vis[N];
ll parent[N];
ll chk[N];
ll color[N];
ll tim[2][N];
ll dis[N];
vector<int> adj[N];
vector<ll> graph[N];
bool has_cycle;
ll maxdis, maxnode, Totnode, cnt = 0;
bool ok = true;
queue<ll> q;
stack<ll> stk;
void dfs(int node) {
  while (cnt != Totnode) {
    cnt++;
    circle.push_back(node);
    vis[node] = true;
    int u = adj[node][0];
    int v = adj[node][1];
    if ((adj[u][0] == v || adj[u][1] == v) && vis[u] == false) {
      dfs(u);
    } else {
      dfs(v);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  int cas = 0;
  ll n, m, i, j, cnt1 = 0, cnt2 = 0, cnt = 0, even = 0, odd = 0, len, k, r, l,
                 z = 0, x = 0, y = 0, flag = 0, sum = 0;
  ll a = 0, b = 0, c = 0, d, ans = 0, zero = 0, fst = 0, null = 0, snd = 0,
     lst = 0, rone = 0, one = 0, pos = 0, neg = 0, mn = INT_MAX, mx = INT_MIN;
  char ch;
  int h1, h2, m1, m2, h;
  int velo1, velo2, ac1, ac2;
  int node, edge, u, v, cost;
  string str, strstore = "";
  cin >> str;
  n = str.size();
  a = b = l = r = -1;
  for (int i = 0; i < n; i++) {
    if (str[i] == '[' && a == -1) {
      a = 1;
    }
    if (str[i] == ':' && a == 1) {
      l = i;
      break;
    }
  }
  for (int i = n - 1; i > l; i--) {
    if (str[i] == ']' && b == -1) {
      b = 1;
    }
    if (str[i] == ':' && b == 1) {
      r = i;
      break;
    }
  }
  if (l == -1 || r == -1 || a == -1 || b == -1) {
    cout << -1 << endl;
  } else {
    cnt = 4;
    for (int i = l + 1; i < r; i++) {
      if (str[i] == '|') {
        cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}