#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int x, y, i, j, k, l, m, n, tc;
  string s;
  cin >> s;
  x = -1;
  y = -1;
  for (i = 0; i < s.length(); i++) {
    if (s[i] == '[') {
      x = i;
      break;
    }
  }
  for (i = s.length() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      y = i;
      break;
    }
  }
  if (x == -1 || y == -1 || x > y) {
    cout << -1;
    return 0;
  }
  m = -1;
  n = -1;
  for (i = x + 1; i < y; i++) {
    if (s[i] == ':') {
      m = i;
      break;
    }
  }
  for (i = y - 1; i > x; i--) {
    if (s[i] == ':') {
      n = i;
      break;
    }
  }
  if (m == n) {
    cout << -1;
    return 0;
  }
  long long int ans = 4;
  for (i = m + 1; i < n; i++) {
    if (s[i] == '|') ans++;
  }
  cout << ans;
  return 0;
}
