#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int lbracket = s.length(), rbracket = -1, lcolon = s.length(), rcolon = -1;
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '[') {
      lbracket = i;
      break;
    }
  for (int i = lbracket; i < s.length(); i++)
    if (s[i] == ':') {
      lcolon = i;
      break;
    }
  for (int i = s.length() - 1; i > -1; i--)
    if (s[i] == ']') {
      rbracket = i;
      break;
    }
  for (int i = rbracket; i > -1; i--)
    if (s[i] == ':') {
      rcolon = i;
      break;
    }
  if (lcolon < rcolon) {
    int ans = 4;
    for (int i = lcolon + 1; i < rcolon; i++)
      if (s[i] == '|') ans++;
    cout << ans;
  } else
    cout << -1;
  return 0;
}
