#include <bits/stdc++.h>
using namespace std;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  cin >> s;
  int ri = -1, le = 1000000;
  int sz = (int)s.length();
  for (int i = 0; i < sz; i++) {
    if (s[i] == ']') {
      ri = i;
    } else if (s[i] == '[') {
      le = min(le, i);
    }
  }
  if (le > ri) {
    cout << -1 << "\n";
    return 0;
  }
  vector<int> ve;
  for (int i = le + 1; i < ri; i++) {
    if (s[i] == ':') {
      ve.push_back(i);
    }
  }
  if ((int)ve.size() < 2) {
    cout << -1 << "\n";
    return 0;
  }
  int lele = ve[0], riri = ve.back();
  int ans = 4;
  for (int i = lele + 1; i < riri; i++) {
    if (s[i] == '|') {
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}
