#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int i = 0;
  char start[2] = {'[', ':'};
  char end[2] = {':', ']'};
  int l = 0;
  int si = -1, ei = -1;
  while (i < str.length()) {
    if (str[i] == start[l] && l == 0)
      l++;
    else if (l == 1 && str[i] == start[l]) {
      si = i;
      break;
    }
    i++;
  }
  if (si == -1) {
    cout << "-1\n";
    return 0;
  }
  i = str.length() - 1;
  l = 1;
  while (i > si) {
    if (str[i] == end[l] && l == 1)
      l--;
    else if (l == 0 && str[i] == end[l]) {
      ei = i;
      break;
    }
    i--;
  }
  if (ei == -1) {
    cout << "-1\n";
    return 0;
  }
  int ans = 4;
  for (int i = si + 1; i < ei; i++) {
    if (str[i] == '|') ans++;
  }
  cout << ans << "\n";
  return 0;
}
