#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);
  int resposta = -1;
  string word;
  cin >> word;
  for (int i = 0; i < (int)word.length(); i++) {
    if (word[i] != '[') continue;
    int A = -1, C = 0;
    bool count = false;
    while (word[i] != '\0') {
      if (word[i] == ':' && !count)
        count = true;
      else if (word[i] == ':' && count)
        A = C;
      if (word[i] == '|' && count)
        C++;
      else if (word[i] == ']' && A != -1) {
        resposta = max(resposta, A + 4);
      }
      i++;
    }
  }
  cout << resposta << '\n';
  return 0;
}
