#include <bits/stdc++.h>
int main() {
  std::string s;
  std::cin >> s;
  int n = -1;
  int rbr = -1;
  int rcol = -1;
  int lbr = -1;
  int lcol = -1;
  int pipes = 0;
  char c;
  for (int i = 0; i < s.size(); i++) {
    c = s[i];
    if (c == '[' && lbr == -1) {
      lbr = i;
    }
    if (c == ':' && lbr != -1 && lcol == -1) {
      lcol = i;
    }
    if (lbr != -1 && lcol != -1) {
      break;
    }
  }
  for (int i = s.size() - 1; i >= 0; i--) {
    c = s[i];
    if (c == ']' && rbr == -1) {
      rbr = i;
    }
    if (c == ':' && rbr != -1 && rcol == -1 && i > lcol) {
      rcol = i;
    }
    if (rbr != -1 && rcol != -1) {
      break;
    }
  }
  for (int i = lcol; i < rcol; i++) {
    c = s[i];
    if (c == '|') {
      pipes++;
    }
  }
  if (rbr != -1 && rcol != -1 && lbr != -1 && lcol != -1) {
    n = pipes + 4;
  }
  std::cout << n << std::endl;
  return 0;
}
