#include <bits/stdc++.h>
using namespace std;
int main() {
  string input;
  cin >> input;
  int n = input.length();
  int start = n, end = -1;
  for (int i = 0; i < n; i++) {
    if (input[i] == '[') {
      bool found = false;
      for (i++; i < n; i++) {
        if (input[i] == ':') {
          start = i, found = true;
          break;
        }
      }
      if (found) break;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    if (input[i] == ']') {
      bool found = false;
      for (i--; i >= 0; i--) {
        if (input[i] == ':') {
          end = i, found = true;
          break;
        }
      }
      if (found) break;
    }
  }
  if (start >= end)
    cout << -1 << endl;
  else {
    int ans = 4;
    for (int i = start; i < end; i++) {
      if (input[i] == '|') {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
