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;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, 1, 0, -1};
const int dl[] = {0, 0, 0, -1};
const int dr[] = {0, 0, -1, 0};
long long Inverse(long long a, long long MOD) {
  long long m = a, n = MOD;
  long long xm = 1, xn = 0;
  while (n != 0) {
    long long q = m / n;
    long long r = m - q * n;
    long long xr = xm - q * xn;
    m = n;
    xm = xn;
    n = r;
    xn = xr;
  }
  return (xm % MOD + MOD) % MOD;
}
int lg(long long x) {
  int res = 0;
  for (int i = 0; i < x; i++) {
    long long GT = (1ll << i);
    if (GT <= x) {
      res = i;
    } else {
      return res;
    }
  }
  return res;
}
long long GCD(long long a, long long b) {
  if (b == 0) {
    return abs(a);
  }
  return GCD(b, a % b);
}
long long sqr(long long x) { return x * x; }
long long nhan(long long a, long long b, long long module) {
  a %= module;
  b %= module;
  long long q = (long double)a * b / module;
  long long r = (a * b - q * module) % module;
  if (r < 0) {
    r += module;
  }
  return r;
}
long long MU(long long a, long long n, long long module) {
  long long res = 1;
  for (; n; n = n >> 1, a = nhan(a, a, module)) {
    if (n & 1) {
      res = nhan(res, a, module);
    }
  }
  return res;
}
void hamZ(string S, int z[]) {
  int n = S.size();
  for (int i = 0; i <= n; i++) {
    z[i] = 0;
  }
  int L = 1, R = 1;
  for (int i = 2; i <= n; i++) {
    if (i <= R) {
      z[i] = min(z[i - L + 1], R - i + 1);
    }
    while (i + z[i] <= n && S[z[i]] == S[i + z[i] - 1]) {
      z[i]++;
    }
    if (i + z[i] - 1 > R) {
      R = i + z[i] - 1;
      L = i;
    }
  }
}
void Sang(int N, vector<int> Uoc[]) {
  for (int i = 1; i <= N; i++) {
    for (int j = i; j <= N; j += i) Uoc[j].push_back(i);
  }
}
struct Point {
  int x, y;
  Point(){};
  Point(int a, int b) {
    x = a;
    y = b;
  }
};
void Tru(Point &A, Point B) {
  A.x -= B.x;
  A.y -= B.y;
}
bool CungChieu(Point O, Point A, Point B) {
  Tru(A, O);
  Tru(B, O);
  return 1ll * A.x * B.y < 1ll * A.y * B.x;
}
bool ThangHang(Point O, Point A, Point B) {
  Tru(A, O);
  Tru(B, O);
  return 1ll * A.x * B.y == 1ll * A.y * B.x;
}
bool NguocChieu(Point O, Point A, Point B) {
  Tru(A, O);
  Tru(B, O);
  return 1ll * A.x * B.y > 1ll * A.y * B.x;
}
const int N = 2e5 + 10;
const double sodu = 1e-9;
const int oo = 1e9;
const int module = 998244353;
const int M = 1e9 + 7;
const int NN = (1 << 16);
void nhap() {}
void solve() {
  string S;
  cin >> S;
  int n = S.size();
  int L = 1;
  while (L <= n && S[L - 1] != '[') L++;
  int R = n;
  while (R >= 1 && S[R - 1] != ']') R--;
  if (L > R) {
    cout << -1;
    return;
  }
  int L1 = L;
  int R1 = R;
  while (L1 <= n && S[L1 - 1] != ':') L1++;
  while (R1 >= 1 && S[R1 - 1] != ':') R1--;
  if (L1 >= R1) {
    cout << -1;
    return;
  }
  int Res = 4;
  for (int i = L1; i <= R1; i++) {
    if (S[i - 1] == '|') Res++;
  }
  cout << Res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  nhap();
  solve();
}