#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int i, j, a = 0, b = 0, t = 0, q = -1;
  string s;
  cin >> s;
  for (i = s.length() - 1; i >= 2; i--) {
    if (s[i] == ']' && q == -1)
      q = i;
    else if (s[i] == ':' && q != -1) {
      j = i;
      break;
    }
  }
  if (q == -1) {
    cout << -1;
    return 0;
  }
  for (i = 0; i < j; i++) {
    if (s[i] == '[')
      a = 1;
    else if (s[i] == ':' && a)
      b = 1;
    else if (s[i] == '|' && a && b)
      t++;
  }
  cout << ((a && b) ? t + 4 : -1);
  return 0;
}
