#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int lb = -1, rb = -1;
  int lc = -1, rc = -1;
  for (int i = 0; i < s.length(); i++) {
    char c = s[i];
    if (c == '[' && lb == -1) {
      lb = i;
    }
    if (c == ':' && lb != -1) {
      lc = i;
      break;
    }
  }
  for (int i = s.length() - 1; i >= 0; i--) {
    char c = s[i];
    if (c == ']' && rb == -1) {
      rb = i;
    }
    if (c == ':' && rb != -1) {
      rc = i;
      break;
    }
  }
  if (rc <= lc || lc == -1 || rc == -1) {
    cout << -1 << endl;
    return 0;
  }
  if (rb <= lb || lb == -1 || rb == -1) {
    cout << -1 << endl;
    return 0;
  }
  if (lc > rb || rc < lb) {
    cout << -1 << endl;
    return 0;
  }
  int len = 4;
  for (int i = lc + 1; i < rc; i++) {
    char c = s[i];
    if (c == '|') {
      len++;
    }
  }
  cout << len << endl;
  return 0;
}
