#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[500007];
  scanf("%s", s + 1);
  int n = int(strlen(s + 1));
  int f = 1, l = n, res = 0;
  while (f <= n && s[f] != '[') f++, res++;
  if (s[f] != '[') exit(printf("-1") & 0);
  while (l >= 1 && s[l] != ']') l--, res++;
  if (s[l] != ']') exit(printf("-1") & 0);
  cerr << "l = " << l << ", f = " << f << '\n';
  f++, l--;
  while (f <= n && s[f] != ':') f++, res++;
  if (s[f] != ':') exit(printf("-1") & 0);
  while (l >= 1 && s[l] != ':') l--, res++;
  if (s[l] != ':') exit(printf("-1") & 0);
  cerr << "l = " << l << ", f = " << f << '\n';
  if (f >= l) exit(printf("-1") & 0);
  f++, l--;
  for (int i = f; i <= l; ++i) res += s[i] != '|';
  cout << n - res;
  return 0;
}
