#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int INF = int(2e9) + 99;
void remove(string &s, char c) {
  auto ind = s.find(c);
  if (ind == string::npos) {
    cout << -1 << '\n';
    exit(0);
  }
  s.erase(0, ind + 1);
  return;
}
void test_case() {
  string s;
  cin >> s;
  remove(s, '[');
  remove(s, ':');
  reverse((s).begin(), (s).end());
  remove(s, ']');
  remove(s, ':');
  int cnt = count((s).begin(), (s).end(), '|');
  cout << cnt + 4 << '\n';
  return;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  int __ = 1;
  while (__--) test_case();
  return 0;
}
