#include <bits/stdc++.h>
using namespace std;
int main() {
  int fl = -1, fr = -1, sl = -1, sr = -1, cnt = 0;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '[') {
      fl = i;
      break;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      fr = i;
      break;
    }
  }
  if (fl >= fr || fl == -1 || fr == -1) {
    cout << -1;
    return 0;
  }
  for (int i = fl; i < fr; i++) {
    if (s[i] == ':') {
      sl = i;
      break;
    }
  }
  for (int i = fr; i >= fl; i--) {
    if (s[i] == ':') {
      sr = i;
      break;
    }
  }
  if (sl == sr || sl == -1 || sr == -1) {
    cout << -1;
    return 0;
  }
  for (int i = sl; i <= sr; i++) {
    if (s[i] == '|') cnt++;
  }
  cout << 4 + cnt;
}
