#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.length();
  bool did1 = false;
  int stpos = -1;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == '[' && !did1) {
      did1 = true;
    }
    if (s.at(i) == ':' && did1) {
      stpos = i + 1;
      break;
    }
  }
  if (stpos == -1) {
    cout << "-1";
    return 0;
  }
  int endpos = -1;
  bool did2 = false;
  for (int i = n - 1; i >= stpos; i--) {
    if (s.at(i) == ']' && !did2) {
      did2 = true;
    }
    if (s.at(i) == ':' && did2) {
      endpos = i - 1;
      break;
    }
  }
  if (endpos == -1) {
    cout << "-1";
    return 0;
  }
  int ans = 4;
  for (int i = stpos; i <= endpos; i++) {
    if (s.at(i) == '|') {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
