#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
int main() {
  string s;
  bool merda = false;
  int ab = -1, fc = 1;
  ;
  cin >> s;
  for (int i = (0); i < (s.size()); i++) {
    if (s[i] == '[' && ab == -1)
      ab = i;
    else if (s[i] == ']')
      fc = i;
  }
  if (ab > fc || ab == -1 || fc == -1)
    merda = true;
  else {
    int a = ab, b = fc;
    ab = fc = -1;
    for (int i = (a + 1); i < (b); i++) {
      if (s[i] == ':' && ab == -1)
        ab = i;
      else if (s[i] == ':')
        fc = i;
    }
    if (ab == -1 || fc == -1)
      merda = true;
    else {
      int tam = 4;
      for (int i = (ab + 1); i < (fc); i++) {
        if (s[i] == '|') tam++;
      }
      printf("%d\n", tam);
    }
  }
  if (merda) puts("-1");
}
