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 <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {}
};
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  if (y == 0) return 1;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int modinv(long long int a, long long int p) {
  return power(a, p - 2, p);
}
void solve() {
  string s;
  cin >> s;
  long long int n = s.size();
  bool f1 = false, f2 = false;
  long long int cnt = 0;
  long long int idx = n;
  long long int ii = -1;
  for (long long int i = n - 1; i >= 0; i--) {
    if (f1 == false && s[i] == ']') {
      f1 = true;
      ii = i;
    }
    if (f1 == true && f2 == false && s[i] == ':') {
      idx = i;
      break;
    }
  }
  long long int x = 0;
  f1 = false, f2 = false;
  for (long long int i = 0; i < n; i++) {
    if (f1 == false and s[i] == '[') {
      f1 = true;
    }
    if (f1 and i <= ii and s[i] == ':') {
      x++;
    }
  }
  if (x < 2) {
    cout << -1 << endl;
    return;
  }
  f1 = false, f2 = false;
  for (long long int i = 0; i < n; i++) {
    if (idx == i) {
      break;
    }
    if (f1 == false && s[i] == '[') {
      f1 = true;
    }
    if (f1 == true && f2 == false && s[i] == ':') {
      f2 = true;
    }
    if (f1 and f2) {
      if (s[i] == '|') {
        cnt++;
      }
    }
  }
  cout << cnt + 4 << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T = 1;
  for (long long int c = 0; c < T; c++) {
    solve();
  }
  return 0;
}