#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size();
  string tostore = "[:|:]";
  int curr = 0;
  unsigned long long toremove = 0;
  int i;
  for (i = 0; i < n; i++) {
    if (s[i] == tostore[curr]) {
      if (curr < 2) curr++;
      if (curr == 2) break;
    } else {
      toremove++;
    }
  }
  int j;
  curr = 4;
  for (j = n - 1; j > i; j--) {
    if (s[j] == tostore[curr]) {
      if (curr > 2) curr--;
      if (curr == 2) break;
    } else {
      toremove++;
    }
  }
  for (int x = i + 1; x < j; x++) {
    if (s[x] != '|') toremove++;
  }
  if (n - toremove >= 4)
    cout << n - toremove;
  else
    cout << -1;
}
