#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long i, index1 = 500000, index2 = -1, p1 = 500000, p2 = -1, len = 4;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == '[') {
      index1 = min(index1, i);
    }
    if (s[i] == ']') {
      index2 = max(index2, i);
    }
  }
  if (index1 == 500000 || index2 == -1) {
    printf("-1");
    return 0;
  }
  for (i = index1 + 1; i < index2; i++) {
    if (s[i] == ':') {
      p1 = min(p1, i);
    }
    if (s[i] == ':') {
      p2 = max(p2, i);
    }
  }
  if (p1 == 500000 || p2 == -1 || p1 == p2) {
    printf("-1");
    return 0;
  }
  for (i = p1 + 1; i < p2; i++) {
    if (s[i] == '|') {
      len++;
    }
  }
  printf("%lld", len);
  return 0;
}
