#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  getline(cin, s);
  int f, l, fc, lc, cnt = 0;
  f = s.find('[');
  l = s.rfind(']');
  if (f != -1) fc = s.find(':', f);
  if (fc != -1) lc = s.rfind(':', l);
  if (f == -1 || l == -1 || fc == -1 || lc == -1 || fc >= lc || f > l ||
      fc < f || lc > l)
    cout << -1 << endl;
  else {
    for (int i = fc + 1; i < lc; i++) {
      if (s[i] != '|') cnt++;
    }
    fc = fc - f - 1;
    lc = l - lc - 1;
    l = s.length() - 1 - l;
    cout << s.length() - cnt - f - l - fc - lc << endl;
  }
  return 0;
}
