#include <bits/stdc++.h>
using namespace std;
char s[500005];
int h, t, ans = -1, len, c[500005];
bool flg = 0;
int main() {
  scanf("%s", s + 1);
  len = strlen(s + 1), c[0] = 0;
  for (int i = 1; i <= len; i++) c[i] = c[i - 1] + (s[i] == '|');
  h = 1, t = len;
  while (h < t) {
    if (!flg) {
      if (s[h] == '[' && s[t] == ']')
        flg = 1, h++, t--;
      else if (s[h] == '[')
        t--;
      else if (s[t] == ']')
        h++;
      else
        h++, t--;
    } else {
      if (s[h] == ':' && s[t] == ':') {
        ans = 4 + c[t] - c[h - 1];
        break;
      } else if (s[h] == ':')
        t--;
      else if (s[t] == ':')
        h++;
      else
        h++, t--;
    }
  }
  printf("%d\n", ans);
  return 0;
}
