Problem: An accordion is a string (yes, in the real world accordions are musical instruments, but let's forget about it for a while) which can be represented as a concatenation of: an opening bracket (ASCII code 091), a colon (ASCII code 058), some (possibly zero) vertical line characters (ASCII code 124), another colon, and a closing bracket (ASCII code 093). The length of the accordion is the number of characters in it.

For example, [::], [:||:] and [:|||:] are accordions having length 4, 6 and 7. (:|:), {:||:}, [:], ]:||:[ are not accordions. 

You are given a string s. You want to transform it into an accordion by removing some (possibly zero) characters from it. Note that you may not insert new characters or reorder existing ones. Is it possible to obtain an accordion by removing characters from s, and if so, what is the maximum possible length of the result?

Input

The only line contains one string s (1 ≤ |s| ≤ 500000). It consists of lowercase Latin letters and characters [, ], : and |.

Output

If it is not possible to obtain an accordion by removing some characters from s, print -1. Otherwise print maximum possible length of the resulting accordion.

Examples

Input


|[a:b:|]


Output


4


Input


|]:[|:]


Output


-1

Solution (in JAVA):

Solution:


import javax.xml.transform.Source;
import java.nio.charset.IllegalCharsetNameException;
import java.rmi.MarshalException;
import java.util.*;
import java.io.*;
import java.math.*;

public class program {
    public static FastIO file = new FastIO();

    private static void solve() {
//        int tt = nextInt();
        int tt = 1;
        long start = 0;
        while (tt-- > 0) {
            char[] c = nextLine().toCharArray();
            int n = c.length;
            int index1 = -1, ii1 = -1;
            for (int i = 0; i < n; i++) {
                if (c[i] == '[') {
                    index1 = i;
                    for (int j = i; j < n; j++) {
                        if (c[j] == ':'){
                            ii1 = j;
                            break;
                        }
                    }
                    break;
                }
            }
            if (index1 == -1 || ii1 == -1) {
                System.out.println(-1);
                return;
            }
            int index2 = -1, ii2 = -1;
            for (int i = n - 1; i >= 0; i--) {
                if (c[i] == ']') {
                    index2 = i;
                    for (int j = i; j >= 0; j--) {
                        if (c[j] == ':'){
                            ii2  = j;
                            break;
                        }
                    }
                    break;
                }
            }
            if (index2 == -1 || ii2 == -1) {
                System.out.println(-1);
                return;
            }
            if (index2 < index1 || ii1 == ii2 || index2 < ii1 || index1 > ii2) {
                System.out.println(-1);
                return;
            }
            int count = 0;
            for (int i = ii1; i < ii2; i++) {
                if (c[i] == '|'){
                    count++;
                }
            }
            System.out.println(count+4);
        }
    }

    private static int[] nextArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public static int[][] nextArray2D(int n, int m) {
        int[][] result = new int[n][];
        for (int i = 0; i < n; i++) {
            result[i] = nextArray(m);
        }
        return result;
    }

    public static long pow(long n, long p) {
        long ret = 1L;
        while (p > 0) {
            if (p % 2 != 0L)
                ret *= n;
            n *= n;
            p >>= 1L;
        }
        return ret;
    }

    public static String next() {
        return file.next();
    }

    public static int nextInt() {
        return file.nextInt();
    }

    public static long nextLong() {
        return file.nextLong();
    }

    public static double nextDouble() {
        return file.nextDouble();
    }

    public static String nextLine() {
        return file.nextLine();
    }

    public static class FastIO {
        BufferedReader br;
        StringTokenizer st;

        public FastIO() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

    public static void main(String[] args) {
        solve();
    }


}