#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s, a = {""};
  cin >> s;
  long long int st = -1000, end = -998, size, ans = 0, nonreq, f1 = 0, f2 = 0,
                t1 = 0, t2 = 0, c1 = -98, c2 = -87;
  for (long long int i = 0; i < s.size(); i++) {
    if (s[i] == '[') {
      st = i;
      t1 = 1;
      break;
    }
  }
  for (long long int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      end = i;
      t2 = 1;
      break;
    }
  }
  if (st > end || t1 == 0 || t2 == 0) {
    cout << "-1";
    return;
  }
  for (long long int i = st + 1; i < end; i++) {
    if (s[i] == ':' && f1 == 0) {
      c1 = i;
      f1++;
      break;
    }
  }
  if (f1 == 0) {
    cout << "-1";
    return;
  }
  for (long long int i = end - 1; i > c1; i--) {
    if (s[i] == ':' && f2 == 0) {
      c2 = i;
      f2++;
      break;
    }
  }
  if (f2 == 0) {
    cout << "-1";
    return;
  }
  for (long long int i = c1; i < c2; i++) {
    if (s[i] == '|') ans++;
  }
  cout << 2 + 2 + ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
