#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int len = s.length();
  int blen1 = -1, blen2 = -1, clen1 = -1, clen2 = -1;
  for (int i = 0; i < len; i++) {
    if (s[i] == '[') {
      blen1 = i;
      break;
    }
  }
  for (int i = len - 1; i > blen1; i--) {
    if (s[i] == ']') {
      blen2 = i;
      break;
    }
  }
  if (blen1 == -1 || blen2 == -1) {
    cout << "-1" << endl;
    return 0;
  }
  for (int i = blen1 + 1; i < blen2; i++) {
    if (s[i] == ':') {
      clen1 = i;
      break;
    }
  }
  for (int i = blen2 - 1; i > clen1; i--) {
    if (s[i] == ':') {
      clen2 = i;
      break;
    }
  }
  if (clen1 == -1 || clen2 == -1) {
    cout << "-1" << endl;
    return 0;
  }
  int temp = 4;
  for (int i = clen1 + 1; i < clen2; i++) {
    if (s[i] == '|') {
      temp++;
    }
  }
  cout << temp << endl;
}
