#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, T, n, m, u, v, p, q, r, s, d;
  string a;
  cin >> a;
  long long ans = -1;
  n = a.length();
  p = -1;
  q = -1;
  r = -1;
  s = -1;
  for (i = 0; i < n; i++)
    if (a[i] == '[') {
      p = i;
      break;
    }
  for (i = p; i < n; i++)
    if (a[i] == ':') {
      q = i;
      break;
    }
  for (i = n - 1; i >= 0; i--)
    if (a[i] == ']') {
      s = i;
      break;
    }
  for (i = s; i >= 0; i--)
    if (a[i] == ':') {
      r = i;
      break;
    }
  if (p != -1 and q != -1 and r != -1 and s != -1 and p < q and q < r and
      r < s) {
    ans = 4;
    for (i = q; i < r; i++)
      if (a[i] == '|') ++ans;
  }
  cout << ans;
}
