#include <bits/stdc++.h>
using namespace std;
vector<int> dr = {+1, -1, +0, +0, +1, -1, -1, +1};
vector<int> dc = {+0, +0, +1, -1, +1, -1, +1, -1};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string word;
  cin >> word;
  int A = 0, fA = -1, fB = -1, fC = -1, fD = -1;
  for (int i = 0; i < word.length(); i++) {
    if (word[i] == '[') {
      fA = i;
      break;
    }
  }
  for (int i = fA + 1; i < word.length(); i++) {
    if (word[i] == ':') {
      fB = i;
      break;
    }
  }
  for (int i = fC + 1; i < word.length(); i++) {
    if (word[i] == ']') fD = i;
  }
  for (int i = fB + 1; i < fD; i++) {
    if (word[i] == ':') fC = i;
  }
  for (int i = fB + 1; i < fC; i++) {
    if (word[i] == '|') A++;
  }
  if (fA != -1 && fB != -1 && fC != -1 && fD != -1)
    cout << A + 4 << '\n';
  else
    cout << -1 << '\n';
  return 0;
}
