#include <bits/stdc++.h>
using namespace std;
string s;
vector<int> suf;
void info(vector<int>& v) {
  for (auto el : v) {
    cout << el << " ";
  }
  cout << endl;
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cin >> s;
  int beg = -1;
  int end = -1;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == '[' && beg == -1) {
      beg = i;
    }
    if (s[i] == ']') {
      end = i;
    }
  }
  if (beg == -1 || end == -1) {
    cout << -1 << endl;
    return 0;
  }
  int l = -1;
  int r = -1;
  for (int i = beg; i < end; ++i) {
    if (s[i] == ':' && l == -1) {
      l = i;
    }
    if (s[i] == ':') {
      r = i;
    }
  }
  if (l == r) {
    cout << -1 << endl;
    return 0;
  }
  int cnt = 0;
  for (int i = l; i < r; ++i) {
    cnt += int(s[i] == '|');
  }
  cout << 4 + cnt << endl;
}
