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:

// LM10: The next Ballon d'Or
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class FastReader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String next(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(next()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public void scanIntArr(int [] arr){ for(int li=0;li<arr.length;++li){ arr[li]=i();}}
        public void scanLongArr(long [] arr){for (int i=0;i<arr.length;++i){arr[i]=l();}}
        public void shuffle(int [] arr){ for(int i=arr.length;i>0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }
    }

    public static void main(String[] args)throws IOException {
        /*

inputCopy
|[a:b:|]
outputCopy
4
inputCopy
|]:[|:]
outputCopy
-1
        */
        PrintWriter pw = new PrintWriter(System.out);
        FastReader fr = new FastReader();
        int t=1;
        for(int ti=0;ti<t;++ti)
        {
            char [] arr=fr.nextLine().toCharArray();
            int openingIndex=-1;
            int closingIndex=-1;
            int openingColon=-1;
            int closingColon=-1;
            for(int ni=0;ni<arr.length;++ni)
            {
                if(arr[ni]=='[')
                {
                    openingIndex=ni;
                    break;
                }
            }
            if(openingIndex==-1)
            {
                pw.println(-1);
                pw.close();
                return;
            }
            for(int ni=arr.length-1;ni>openingIndex;--ni)
            {
                if(arr[ni]==']')
                {
                    closingIndex=ni;
                    break;
                }
            }
            if(closingIndex==-1)
            {
                pw.println(-1);
                pw.close();
                return;
            }
            for(int ni=openingIndex+1;ni<closingIndex;++ni)
            {
                if(arr[ni]==':')
                {
                    openingColon=ni;
                    break;
                }
            }
            if(openingColon==-1)
            {
                pw.println(-1);
                pw.close();
                return;
            }
            for(int ni=closingIndex-1;ni>openingColon;--ni)
            {
                if(arr[ni]==':')
                {
                    closingColon=ni;
                    break;
                }
            }
            if(closingColon==-1)
            {
                pw.println(-1);
                pw.flush();
                pw.close();
                return;
            }
            int ans=4;
            for(int ni=openingColon+1;ni<closingColon;++ni)
            {
                if(arr[ni]=='|')
                {
                    ++ans;
                }
            }
            pw.println(ans);
        }
        pw.flush();
        pw.close();
    }
}