#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  int l_beg = -1;
  int r_beg = -1;
  string pattern = "[:";
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == pattern[j]) {
      j++;
      if (j == 2) {
        l_beg = i;
        break;
      }
    }
  }
  pattern = "]:";
  for (int i = n - 1, j = 0; i >= 0; i--) {
    if (s[i] == pattern[j]) {
      j++;
      if (j == 2) {
        r_beg = i;
        break;
      }
    }
  }
  if (r_beg == -1 || l_beg == -1 || l_beg >= r_beg) {
    cout << -1 << endl;
  } else {
    int ans = 0;
    for (int i = l_beg + 1; i < r_beg; i++)
      if (s[i] == '|') ans += 1;
    cout << ans + 4 << endl;
  }
  return 0;
}
