#include <bits/stdc++.h>
using namespace std;
string str;
int main() {
  cin >> str;
  int b = str.size() - 1;
  int a = 0;
  while (str[a] != '[' && a < str.size()) {
    a++;
  }
  while (str[b] != ']' && b >= 0) {
    b--;
  }
  if (b < a) {
    cout << "-1\n";
    return 0;
  }
  int c = a, d = b;
  while (str[c] != ':' && c < str.size()) {
    c++;
  }
  while (str[d] != ':' && d >= 0) {
    d--;
  }
  if (d <= c) {
    cout << "-1\n";
    return 0;
  }
  int qt = 4;
  for (int i = c; i <= d; i++) {
    if (str[i] == '|') {
      qt++;
    }
  }
  cout << qt << endl;
}
