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.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.awt.Point;

 
public class TryB
{
    
    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);
 static char [][]sol;
    public static void main(String[] args)
    {
        
        InputReader sc = new InputReader(System.in);
        //PrintWriter w = new PrintWriter(System.out);
    
       /* 
        prime  = new boolean[n + 1];
		sieve();
		prime[1] = false;
		*/
		/*
		as = new ArrayList<>();
		for(int i=2;i<=1000000;i++)
		{
		    if(prime[i])
		    as.add(i);
		}
		*/
		
       /* 
		
	long a = sc.nl();
	 
            BigInteger ans = new BigInteger("1");
            for (long i = 1; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    if (a / i == i) {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        
                    } else {
                        ans = ans.multiply(BigInteger.valueOf(phi(i)));
                        ans = ans.multiply(BigInteger.valueOf(phi(a / i)));
 
                        
                    }
 
 
                }
            }
            w.println(ans.mod(bigInteger));
            */
          
         // MergeSort ob = new MergeSort();
       // ob.sort(arr, 0, arr.length-1);
       
    // Student []st = new Student[x];    
   // st[i] = new Student(i,d[i]);
     //Arrays.sort(st,(p,q)->p.diff-q.diff);



   String s = sc.rs();
   char []c = s.toCharArray();
   int l = 0;
   int f = 0;
   int j = -1;
   int ans = -1;
  while(l < s.length() && c[l]!='[' )
  {
      l++;
      
  }
  
       while(l < s.length()&& c[l] != ':')
       {
           
               l++;
           
          
       }
   
   int r = s.length()-1;
   while( r >= 0 && c[r]!=']')
   {
       r--;
   }
    while( r >= 0 && c[r]!=':')
   {
       r--;
   }
   ans = 4;
   if(l < r)
   {
       for(int i=l+1;i<r;i++)
       {
           if(s.charAt(i) == '|')
               ans++;
       }
       w.println(ans);
   }
   else
       w.println("-1");
    
   

    
     w.close();
        
  
    
    }
public static boolean canPaint(int[][]grid,int i,int j){
		for(int a=-1;a<=1;a++)
			for(int b=-1;b<=1;b++)
				if((a!=0||b!=0)&&grid[i+a][j+b]==0)
					return false;
		return true;
	}
	
public static void paint(int[][]grid,int i,int j){
		for(int a=-1;a<=1;a++)
			for(int b=-1;b<=1;b++)
				if(a!=0||b!=0)
					grid[i+a][j+b]=1;
	}
	 
 static String test(int[][]grid){
		for(int[]i:grid)
			for(int j:i)
				if(j==2)
					return "NO";
		return "YES";
	}  
    /*
     static void dfs(List<Integer>[] graph, int u,int []p1,List<Integer> res) {
      //res = new ArrayList<>();
    vis[u] = true;
    for (int v : graph[u])
      if (!vis[v])
        dfs(graph, v,p1,res);
    res.add(u);
    ts.add(p1[u-1]);
  
  }
*/
    static int log(long base,long sum)
    {
        long temp = sum;
        int i = 0;
        while(sum > 0)
        {
            sum /= base;
            i++;
        }
        return i;
    }
    static boolean checkT(int a,int b, int c)
    {
        int f = 0;
        if(a+b <= c || b+c <=a||a+c <= b)
            return false;
        else
            return true;
    }
    static double costheta(int a,int b,int c)
    {
        double pos = ((double)b*(double)b + (double)c*(double)c-(double)a*(double)a) / (2*(double)b*(double)c);
         return pos;
    }
     public static int ip(String s){
		return Integer.parseInt(s);
	}
	 public static String ips(int s){
		return Integer.toString(s);
	}
         static long area(int ax,int ay,int bx,int by,int cx,int cy)
         {
             long ar = ((long)ax*((long)by-(long)cy)) + ((long)bx*((long)cy-(long)ay)) + ((long)cx*((long)ay-(long)by));
             return Math.abs(ar);
         }
       
        
    
   static class Student
    {
        
        int x;
        int y;
        Student(int x,int y)
        {
            this.x = x;
            this.y = y;
            
            
        }
        
    }
}