#include <bits/stdc++.h>
using namespace std;
long long inf = 1e9;
int32_t main() {
  string s;
  cin >> s;
  long long n = s.size();
  long long left = inf, right = -inf;
  for (long long x = 0; x < n; x++) {
    if (s[x] == '[') {
      left = min(left, x);
    }
    if (s[x] == ']') {
      right = max(right, x);
    }
  }
  if (left == inf || right == -inf || (left == right))
    return cout << -1 << endl, 0;
  long long leftC = inf, rightC = -inf;
  for (long long x = left + 1; x <= right - 1; x++) {
    if (s[x] == ':') {
      leftC = min(leftC, x);
      rightC = max(rightC, x);
    }
  }
  if (leftC == inf || rightC == -inf || (leftC == rightC))
    return cout << -1 << endl, 0;
  long long cnt = 0;
  for (long long x = leftC + 1; x <= rightC - 1; x++) {
    cnt += s[x] == '|';
  }
  cout << 4 + cnt << endl;
  return 0;
}
