#include <bits/stdc++.h>
using namespace std;
char s[500002];
int main() {
  int n, ans;
  scanf("%s", s);
  n = strlen(s);
  int o = n, e = -1, a = n, b = -1, B = -1;
  for (int i = 0; i < n; ++i)
    if (s[i] == '[' && o == n)
      o = i;
    else if (s[i] == ']')
      e = i;
    else if (s[i] == ':' && o < n) {
      a = min(a, i);
      b = i;
    }
  for (int i = a + 1; i < e; ++i)
    if (s[i] == ':') b = i;
  if (a == b || o == n || e == -1 || a == n || b == -1 || b > e)
    printf("-1\n");
  else {
    ans = 4;
    for (int i = a + 1; i < b; ++i)
      if (s[i] == '|') ++ans;
    printf("%d\n", ans);
  }
  return 0;
}
