#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long n = s.size();
  long long st = -1, en = -1, pec = -1, cec = -1;
  for (long long i = 0; i < n; i++) {
    if (s[i] == '[') {
      st = i;
      break;
    }
  }
  for (long long i = n - 1; i >= 0; i--) {
    if (s[i] == ']') {
      en = i;
      break;
    }
  }
  if (st >= en || st == -1 || en == -1) {
    cout << -1;
    return 0;
  }
  for (long long i = st + 1; i < en; i++) {
    if (s[i] == ':') {
      pec = i;
      break;
    }
  }
  for (long long i = en - 1; i > st; i--) {
    if (s[i] == ':') {
      cec = i;
      break;
    }
  }
  long long cnt = 0;
  if (pec == -1 || cec == -1 || cec == pec) {
    cout << -1;
    return 0;
  }
  for (long long i = pec + 1; i < cec; i++) {
    if (s[i] == '|') cnt++;
  }
  cnt += 4;
  cout << cnt;
  return 0;
}
