#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t, i, j, k, l, m, n, p, q, r, s = 0, ans = 0, a, b, c, d, x, y;
  string s1;
  cin >> s1;
  l = s1.length();
  n = l;
  p = -1;
  for (i = 0; i < n; i++) {
    if (s1[i] == '[') {
      p = i;
      break;
    }
  }
  if (p == -1) {
    cout << "-1\n";
    return 0;
  }
  a = -1;
  for (i = p; i < n; i++) {
    if (s1[i] == ':') {
      a = i;
      break;
    }
  }
  if (a == -1) {
    cout << "-1\n";
    return 0;
  }
  long long a1 = a;
  p = -1;
  for (i = n - 1; i >= 0; i--) {
    if (s1[i] == ']') {
      p = i;
      break;
    }
  }
  if (p == -1) {
    cout << "-1\n";
    return 0;
  }
  a = -1;
  for (i = p; i >= 0; i--) {
    if (s1[i] == ':') {
      a = i;
      break;
    }
  }
  if (a == -1) {
    cout << "-1\n";
    return 0;
  }
  ans = 0;
  if (a1 >= a) {
    cout << "-1\n";
    return 0;
  }
  for (i = a1; i <= a; i++) {
    if (s1[i] == '|') ans++;
  }
  ans += 4;
  cout << ans << endl;
}
