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