#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int pr[500000] = {0};
  int l = 0, r = 0, ok = 0, t = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '[') ok = 1;
    if (s[i] == ':' && ok == 1) {
      l = i;
      ok = 2;
      break;
    }
  }
  for (int i = s.size(); i >= 0; i--) {
    if (s[i] == ']' && ok == 2 && i > l) {
      ok = 3;
      t = i;
    }
    if (s[i] == ':' && ok == 3 && i > l && i < t) {
      ok = 4;
      r = i;
    }
  }
  if (ok != 4) {
    cout << "-1";
    return 0;
  }
  int cnt = 0;
  for (int i = l; i <= r; i++) {
    if (s[i] == '|') cnt++;
  }
  cout << cnt + 4;
  return 0;
}
