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;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long int poww(long long int b, long long int e) {
  if (e == 0)
    return 1;
  else if (e % 2 == 0) {
    long long int a = pow(b, e / 2);
    return a * a;
  } else {
    long long int a = pow(b, e / 2);
    return b * a * a;
  }
}
long long int powm(long long int x, long long int y,
                   long long int m = 1000000007) {
  x = x % m;
  long long int res = 1;
  while (y) {
    if (y & 1) res = res * x;
    res %= m;
    y = y >> 1;
    x = x * x;
    x %= m;
  }
  return res;
}
long long int modInverse(long long int a, long long int m = 1000000007) {
  if (m == 1) return 0;
  long long int m0 = m, y = 0, x = 1;
  while (a > 1) {
    long long int q = a / m, t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long int ans = s.size(), n = s.size();
  long long int idx = -1;
  for (long long int i = (0); i <= (n - 1); i += (1)) {
    if (s[i] == '[') {
      idx = i;
      break;
    } else
      --ans;
  }
  for (long long int i = (idx + 1); i <= (n - 1); i += (1)) {
    if (s[i] == ':') {
      idx = i;
      break;
    } else
      --ans;
  }
  long long int idx1 = n;
  for (long long int i = (n - 1); i >= (0); i -= (1)) {
    if (s[i] == ']') {
      idx1 = i;
      break;
    } else
      --ans;
  }
  for (long long int i = (idx1 - 1); i >= (0); i -= (1)) {
    if (s[i] == ':') {
      idx1 = i;
      break;
    } else
      --ans;
  }
  for (long long int i = (idx + 1); i <= (idx1 - 1); i += (1)) {
    if ((s[i] == '|'))
      ;
    else
      --ans;
  }
  if (idx == idx1) ans = -1;
  cout << (ans <= 0 ? -1 : ans);
  return 0;
}