#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int pos2, pos3, c1 = 0, c3 = 0, n, i, k = 0;
  string s;
  cin >> s;
  n = s.length();
  pos2 = n;
  pos3 = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '[' && c1 == 0) c1++;
    if (s[i] == ':' && c1 == 1) {
      pos2 = i;
      break;
    }
  }
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == ']' && c3 == 0) c3++;
    if (s[i] == ':' && c3 == 1) {
      pos3 = i;
      break;
    }
  }
  for (i = pos2 + 1; i < pos3; i++) {
    if (s[i] == '|') k++;
  }
  if ((c1 == 1 && c3 == 1) && pos2 < pos3)
    cout << k + 4 << "\n";
  else
    cout << "-1"
         << "\n";
  return 0;
}
