#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
void solve() {
  string s;
  cin >> s;
  long long n = ((long long)(s).length());
  long long i = 0;
  long long p = 0;
  while (s[i] != '[' && i < n) {
    p += 1;
    i++;
  }
  if (i == n) {
    cout << "-1";
    return;
  }
  i++;
  while (s[i] != ':' && i < n) {
    p += 1;
    i++;
  }
  if (i == n) {
    cout << "-1";
    return;
  }
  long long j = n - 1;
  while (s[j] != ']' && j >= 0) {
    p += 1;
    j--;
  }
  if (j == -1) {
    cout << "-1";
    return;
  }
  j--;
  while (s[j] != ':' && j >= 0) {
    p += 1;
    j--;
  }
  if (j == -1) {
    cout << "-1";
    return;
  }
  if (j == -1) {
    cout << "-1";
    return;
  }
  if (j <= i) {
    cout << "-1";
    return;
  } else {
    i++;
    while (i < j) {
      if (s[i] != '|') p += 1;
      i++;
    }
    cout << n - p;
  }
}
int32_t main(int32_t argc, char **argv) {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
  return 0;
}
