#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, i, j, k, ans, m, n, x, y;
  t = 1;
  while (t--) {
    string s;
    long long a = -1, b = -1, c = -1, d = -1;
    cin >> s;
    n = s.size();
    for (long long p = 0; p < n; p++) {
      if (s[p] == '[') {
        a = p;
        break;
      }
    }
    if (a == -1) {
      cout << -1;
      return 0;
    }
    for (long long p = a + 1; p < n; p++) {
      if (s[p] == ':') {
        b = p;
        break;
      }
    }
    if (b == -1) {
      cout << -1;
      return 0;
    }
    for (long long p = n - 1; p >= b + 1; p--) {
      if (s[p] == ']') {
        d = p;
        break;
      }
    }
    if (d == -1) {
      cout << -1;
      return 0;
    }
    for (long long p = d - 1; p >= b + 1; p--) {
      if (s[p] == ':') {
        c = p;
        break;
      }
    }
    if (c == -1) {
      cout << -1;
      return 0;
    }
    ans = 4;
    for (long long p = b + 1; p < c; p++)
      if (s[p] == '|') ans++;
    cout << ans;
  }
  return 0;
}
