#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int b = 500000, e = -1, l = 500000, r = -1, count = 4;
  cin >> str;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '[') {
      b = i;
      break;
    }
  }
  for (int i = str.size() - 1; i >= 0; i--) {
    if (str[i] == ']') {
      e = i;
      break;
    }
  }
  if (b >= e) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = b + 1; i < str.size(); i++) {
    if (str[i] == ':') {
      l = i;
      break;
    }
  }
  for (int i = e - 1; i >= 0; i--) {
    if (str[i] == ':') {
      r = i;
      break;
    }
  }
  if (l >= r) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = l + 1; i < r; i++) {
    if (str[i] == '|') count++;
  }
  cout << count << endl;
}
