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 java.util.*;
import java.lang.*;
import java.lang.reflect.Array;
import java.io.*;
import java.util.HashMap;
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.Scanner; 
import java.util.StringTokenizer; 
import java.io.DataInputStream; 
import java.io.FileInputStream; 
public class Prac {
    public static int min(int a,int b,int c){
        if(a<b){
            if(a<c)
                return a;
            
            else
                return c;
        }
        else{
            if(b<c)
                return b;
            else
                return c;
        }   
}
    public static int max(int a,int b,int c){
        if(a<b){
            if(b<c)
                return c;
            
            else
                return b;
        }
        else{
            if(a<c)
                return c;
            else
                return a;
        }   
}
    static class InputReader {
 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
 
		public InputReader(InputStream st) {
			this.stream = st;
		}
 
		public int read() {
			if (snumChars == -1)
	 			throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int ni() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nl() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nia(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = ni();
			}
			return a;
		}
 
		public String rs() {
			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 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 boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}
	
    
    
    static PrintWriter w = new PrintWriter(System.out);
    
    public static void main(String[] args) throws IOException {
        InputReader sc=new InputReader(System.in);
        
       
        String s=sc.nextLine();
       int i=0;
       boolean ob=false,cb=false,oc=false,cc=false;
       int vl=0,maxvl=0;
       int fin=0;
       int bin=0;
       for(i=0;i<s.length();i++){
           
           char a=s.charAt(i);
           char b=s.charAt(s.length()-1-i);
           
           if(a=='['){
               ob=true;
           }
           else if(ob&&a==':'&&!oc){
               oc=true;
               fin=i;
           }
         /* else if(oc&&a=='|'&&!cc){
               vl++;
           }
          else if(oc&&a==':'){
               maxvl=vl;
               cc=true;
           }
          else if(cc&&a==']'){
               cb=true;
           }*/
           if(b==']'){
               cb=true;
           }
           else if(cb&&b==':'&&fin!=s.length()-i-1&&!cc){
               cc=true;
               bin=s.length()-1-i;
           }
       }
       if(fin>=bin||!oc||!cc)
           w.println(-1);
       else{
           for(i=fin+1;i<bin;i++){
               char c=s.charAt(i);
               if(c=='|')
                   vl++;
                   
            }
            w.println(vl+4);
       }
      
       
       w.close();
    
    
  
    }  
}