#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  long long l = -1, r = -1;
  for (long long i = 0; i < s.length(); i++) {
    if (s[i] == '[') {
      l = i;
      break;
    }
  }
  for (long long i = s.length(); i >= 0; i--) {
    if (s[i] == ']') {
      r = i;
      break;
    }
  }
  if (l == -1 || r == -1 || r < l)
    cout << "-1"
         << "\n",
        exit(0);
  s = s.substr(l, r - l + 1);
  l = -1;
  r = -1;
  for (long long i = 1; i < s.length() - 1; i++) {
    if (s[i] == ':') {
      l = i;
      break;
    }
  }
  for (long long i = s.length() - 2; i >= 1; i--) {
    if (s[i] == ':') {
      r = i;
      break;
    }
  }
  if (l == r || l == -1) cout << "-1\n", exit(0);
  string v = s.substr(l, r - l + 1);
  long long ct = 0;
  for (auto it : v) {
    if (it == '|') ct++;
  }
  cout << ct + 4 << "\n";
  return 0;
}
