#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  getline(cin, str);
  long long len;
  len = str.size();
  int step1 = 0, step2 = len - 1;
  int sum = 4;
  while (str[step1] != '[' && step1 <= len - 1) step1++;
  while (str[step2] != ']' && step2 >= step1) step2--;
  if (step1 >= step2)
    cout << -1 << endl;
  else {
    while (str[step1] != ':' && step1 <= step2) step1++;
    while (str[step2] != ':' && step1 < step2) step2--;
    if (step2 <= step1)
      cout << -1 << endl;
    else {
      for (int i = step1; i <= step2; i++)
        if (str[i] == '|') sum++;
      cout << sum << endl;
    }
  }
  int p;
}
