#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, MOD = 1000000007;
const long double PI = 3.14159265359;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string st;
  cin >> st;
  stack<char> stck;
  int i = 0, cnt = 0, temp;
  bool ok = 1;
  while (st[i] != '[' && i < st.size()) i++;
  if (i == st.size()) ok = 0;
  while (st[i] != ':' && i < st.size()) i++;
  if (i == st.size()) ok = 0;
  temp = i;
  i = st.size() - 1;
  while (st[i] != ']' && i > temp) i--;
  if (i == temp) ok = 0;
  while (st[i] != ':' && i > temp) i--;
  if (i == temp) ok = 0;
  while (i > temp) {
    if (st[i] == '|') cnt++;
    i--;
  }
  cout << (ok ? cnt + 4 : -1);
  return 0;
}
