#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin >> a;
  int lb, rb, lc, rc;
  lc = lb = a.size() + 5;
  rc = rb = 0;
  for (int i = 0; i < a.size(); i++) {
    if (a[i] == '[') {
      lb = i;
      break;
    }
  }
  for (int i = a.size() - 1; i >= 0; i--) {
    if (a[i] == ']') {
      rb = i;
      break;
    }
  }
  if (lb > rb - 3) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = lb + 1; i < rb; i++) {
    if (a[i] == ':') {
      lc = i;
      break;
    }
  }
  for (int i = rb - 1; i > lb; i--) {
    if (a[i] == ':') {
      rc = i;
      break;
    }
  }
  if (lc > rc - 1) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  for (int i = lc; i < rc; i++) {
    if (a[i] == '|') {
      ans++;
    }
  }
  cout << ans + 4 << endl;
}
