#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y, z;
  bool operator<(const P &a) const {
    if (x != a.x) return x > a.x;
    return y > a.y;
  }
};
vector<int> v[111111];
int i, n, d, m, k, a, b, c;
long long o[111111];
int l[3331];
int j[3331];
int e;
int dx[10] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[10] = {1, 0, -1, 0, 1, -1, 1, -1},
    dz[10] = {0, 0, 0, 0, 1, -1};
long long mod = 1000000007, mod2 = 1000000009, mod3 = 2017;
long long x, z, y;
double pi = 3.14159265;
P u[3331];
stack<int> s;
queue<int> q;
string r, r1;
bool as(P a, P b) { return a.x + a.y > b.x + b.y; }
long long f(int n) {
  if (o[n]) return o[n];
  o[n] = 1;
  for (int h = 0; h < v[n].size(); h++) o[n] *= (f(v[n][h]) + 1), o[n] %= mod;
  return o[n];
}
int main() {
  cin >> r;
  for (; r[a] != '[' && a < r.size(); a++)
    ;
  for (b = r.size() - 1; b >= 0 && r[b] != ']'; b--)
    ;
  if (a == r.size() || b < 0 || a > b) {
    puts("-1");
    return 0;
  }
  for (n = a; r[n] != ':' && n < r.size(); n++)
    ;
  for (m = b; m >= 0 && r[m] != ':'; m--)
    ;
  if (n >= m) {
    puts("-1");
    return 0;
  }
  k = 4;
  for (int t = n + 1; t < m; t++)
    if (r[t] == '|') k++;
  printf("%d", k);
}
