#include <bits/stdc++.h>
using namespace std;
string s;
int l1, l2, r1, r2;
int ans;
int main() {
  cin >> s;
  for (l1 = 0; l1 < s.size(); l1++) {
    if (s[l1] == '[') {
      break;
    }
  }
  for (l2 = l1 + 1; l2 < s.size(); l2++) {
    if (s[l2] == ':') {
      break;
    }
  }
  for (r1 = s.size() - 1; r1 >= 0; r1--) {
    if (s[r1] == ']') {
      break;
    }
  }
  for (r2 = r1 - 1; r2 > l2; r2--) {
    if (s[r2] == ':') {
      break;
    }
  }
  if (l1 >= r1 || r2 <= l2 || l2 <= l1 || r2 >= r1)
    printf("-1\n");
  else {
    int tot = 0;
    for (int i = l2 + 1; i < r2; i++)
      if (s[i] == '|') tot++;
    printf("%d\n", tot + 4);
  }
  return 0;
}
