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>
const double PI = acos(-1);
const double EPS = 1e-6;
const long long MOD = 1000000007;
const long long INF = 0x3F3F3F3F;
template <typename T>
inline T Abs(T x) {
  return x < 0 ? x * -1 : x;
}
template <typename T>
inline T Max(T x, T y, T z) {
  return std::max(std::max(x, y), z);
}
template <typename T>
inline T Min(T x, T y, T z) {
  return std::min(std::min(x, y), z);
}
template <typename T>
inline T Ckmax(T &x, T y) {
  return x = std::max(x, y);
}
template <typename T>
inline T Ckmin(T &x, T y) {
  return x = std::min(x, y);
}
template <typename T>
inline T Sqr(T x) {
  return x * x;
}
template <typename T>
inline T Pow(T x, T y) {
  T r = 1;
  while (y > 0) {
    if (y % 2 > 0) (r *= x) %= MOD;
    (x *= x) %= MOD;
    y /= 2;
  }
  return r % MOD;
}
template <typename T>
T Pow(T x, T y, T z) {
  T r = 1;
  while (y > 0) {
    if (y % 2 > 0) (r *= x) %= z;
    (x *= x) %= z;
    y /= 2;
  }
  return r % z;
}
template <typename T>
inline T gcd(T x, T y) {
  return y > 0 ? gcd(y, x % y) : x;
}
template <typename T>
inline T lcm(T x, T y) {
  return x / gcd(x, y) * y;
}
inline void cinspu(void) {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
}
inline long long read(void) {
  char x;
  while (x = getchar(), x != '-' && !isdigit(x))
    ;
  char flg = x == '-';
  long long num = (flg ? getchar() : x) - '0';
  while (isdigit(x = getchar())) (num *= 10) += x - '0';
  return flg ? -num : num;
}
const long long N = 500000 + 10;
char s[N];
int main() {
  cinspu();
  std::cin >> (s + 1);
  int n = strlen(s + 1);
  int l = 1, flg = 0;
  for (; l <= n && flg <= 2; ++l) {
    if (s[l] == '[') flg = 1;
    if (flg == 1 && s[l] == ':') {
      flg = 2;
      break;
    }
  }
  if (flg < 2) {
    std::cout << -1 << std::endl;
    return 0;
  }
  int r = n;
  flg = 0;
  for (; r && flg <= 2; --r) {
    if (s[r] == ']') flg = 1;
    if (flg == 1 && s[r] == ':') {
      flg = 2;
      break;
    }
  }
  if (flg < 2 || l >= r) {
    std::cout << -1 << std::endl;
    return 0;
  }
  int ans = 4;
  for (int i = l + 1; i < r; ++i)
    if (s[i] == '|') ++ans;
  std::cout << ans << std::endl;
  return 0;
}