#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  cin >> s;
  int len1, len2;
  int r1, r2;
  len1 = 0;
  while (len1 < s.length() && s[len1] != '[') len1++;
  len2 = len1 + 1;
  while (len2 < s.length() && s[len2] != ':') len2++;
  r1 = int(s.length()) - 1;
  while (r1 >= 0 && s[r1] != ']') r1--;
  r2 = r1 - 1;
  while (r2 >= 0 && s[r2] != ':') r2--;
  if (len2 >= r2) {
    printf("-1\n");
    return 0;
  }
  int res = 4;
  for (int i = len2 + 1; i <= r2 - 1; i++)
    if (s[i] == '|') res++;
  printf("%d\n", res);
  return 0;
  return 0;
}
