#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
unsigned long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
vector<long long> z_function(string s) {
  long long n = (long long)s.length();
  vector<long long> z(n);
  for (long long i = 1, l = 0, r = 0; i < n; ++i) {
    if (i <= r) z[i] = min(r - i + 1, z[i - l]);
    while (i + z[i] < n && s[z[i]] == s[i + z[i]]) ++z[i];
    if (i + z[i] - 1 > r) l = i, r = i + z[i] - 1;
  }
  return z;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  string s;
  cin >> s;
  long long j = inf;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == '[') {
      j = i;
      break;
    }
  }
  long long r = inf;
  for (long long i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      r = i;
      break;
    }
  }
  if (j == inf || r == inf) {
    cout << -1 << "\n";
    return 0;
  }
  long long x = inf;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == ':' && i > j && i < r) {
      x = i;
      break;
    }
  }
  long long y = inf;
  for (long long i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ':' && i > j && i < r && i != x) {
      y = i;
      break;
    }
  }
  if (x == inf || y == inf) {
    cout << -1 << "\n";
    return 0;
  }
  long long ans = 0;
  for (long long i = x + 1; i < y; i++) {
    if (s[i] == '|') {
      ans += 1;
    }
  }
  cout << ans + 4 << "\n";
}
