#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  bool b = 0;
  int pos1 = s.size(), pos2 = 0;
  for (int i = 0; s[i]; i++) {
    if (s[i] == '[') {
      b = 1;
    } else if (s[i] == ':' && b) {
      pos1 = i;
      break;
    }
  }
  b = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == ']') {
      b = 1;
    } else if (s[i] == ':' && b) {
      pos2 = i;
      break;
    }
  }
  if (pos1 < pos2) {
    int count = 4;
    for (int i = pos1 + 1; i < pos2; i++) {
      if (s[i] == '|') count++;
    }
    cout << count;
  } else
    cout << "-1";
  return 0;
}
