#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long a = -1, b = -1;
  int flag = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '[') {
      a = i;
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << "-1";
    return 0;
  }
  flag = 0;
  for (int i = a; i < s.length(); i++) {
    if (s[i] == ':') {
      a = i;
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << "-1";
    return 0;
  }
  flag = 0;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      b = i;
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << "-1";
    return 0;
  }
  flag = 0;
  for (int i = b; i >= 0; i--) {
    if (s[i] == ':') {
      b = i;
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << "-1";
    return 0;
  }
  if (a >= b) {
    cout << "-1";
    return 0;
  }
  long long ans = 4;
  for (int i = a + 1; i <= b - 1; i++) {
    if (s[i] == '|') ans++;
  }
  cout << ans << endl;
}
