#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const int maxn = 5e5 + 10;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const double eps = 1e-7;
using namespace std;
char s[maxn];
int l, ll, rr, r;
int main() {
  scanf("%s", s);
  l = ll = rr = r = -1;
  int len = strlen(s);
  for (int i = 0; i <= len - 1; ++i) {
    if (s[i] == '[') {
      l = i;
      break;
    }
  }
  for (int i = len - 1; i >= l + 1; --i) {
    if (s[i] == ']') {
      r = i;
      break;
    }
  }
  for (int i = l + 1; i <= r - 1; ++i) {
    if (s[i] == ':') {
      ll = i;
      break;
    }
  }
  for (int i = r - 1; i >= ll + 1; --i) {
    if (s[i] == ':') {
      rr = i;
      break;
    }
  }
  if (ll == -1 || rr == -1 || r == -1 || l == -1)
    puts("-1");
  else {
    int ans = 0;
    for (int i = ll + 1; i <= rr - 1; ++i) {
      if (s[i] == '|') ans++;
    }
    printf("%d\n", 4 + ans);
  }
  return 0;
}
