#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1e6;
const int Inf = 1 << 30;
char s[MaxN + 5];
int main() {
  int len, ans, pos, pp;
  while (~scanf(" %s", s + 1)) {
    pos = ans = 0;
    len = strlen(s + 1);
    for (int i = 1; i <= len; i++) {
      if (pos == 0 && s[i] == '[')
        pos++;
      else if (pos == 1 && s[i] == ':') {
        pos++;
        pp = i;
        break;
      }
    }
    for (int i = len; i > pp; i--) {
      if (pos == 2 && s[i] == ']')
        pos++;
      else if (pos == 3 && s[i] == ':') {
        pos++;
        ans = 4;
        for (int j = i - 1; j > pp; j--)
          if (s[j] == '|') ans++;
        break;
      }
    }
    if (pos != 4) ans = -1;
    printf("%d\n", ans);
  }
  return 0;
}
