#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int i = 0, n = s.size(), x1 = -1, x2 = -1, x3 = -1, x4 = -1;
  for (int i = 0; i < n; i++)
    if (s[i] == '[' && x1 == -1) x1 = i;
  for (int i = x1; i < n; i++)
    if (s[i] == ':' && x2 == -1) x2 = i;
  for (int i = n - 1; i > x2; i--)
    if (s[i] == ']' && x3 == -1) x3 = i;
  for (int i = x3; i > x2; i--)
    if (s[i] == ':' && x4 == -1) x4 = i;
  if (x1 != -1 && x2 != -1 && x3 != -1 && x4 != -1) {
    int count = 0;
    for (int i = x2; i <= x4; i++) {
      if (s[i] == '|') count++;
    }
    cout << count + 4 << endl;
  } else
    cout << "-1" << endl;
}
