#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void cp() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve() {
  string s;
  cin >> s;
  if (s.length() < 4) {
    cout << -1 << endl;
    return;
  }
  if (s == "[::]") {
    cout << 4 << endl;
    return;
  }
  if (s == "[:|:]") {
    cout << 5 << endl;
    return;
  }
  int l = 0, r = s.length() - 1;
  int distance = 0;
  while (l < r and s[l] != '[') {
    l++;
    distance++;
  }
  while (r > l and s[r] != ']') {
    r--;
    distance++;
  }
  if (l >= r) {
    cout << -1 << endl;
    return;
  }
  l++;
  r--;
  while (l < r and s[l] != ':') {
    l++;
    distance++;
  }
  while (r > l and s[r] != ':') {
    r--;
    distance++;
  }
  if (l >= r) {
    cout << -1 << endl;
    return;
  }
  int len = 0;
  for (int i = l + 1; i < r; i++) {
    if (s[i] != '|') len++;
  }
  distance += len;
  cout << s.length() - distance << endl;
}
int32_t main() {
  cp();
  int t = 1;
  while (t--) solve();
  return 0;
}
