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.*;
public class Solutions {
	static Scanner scr=new Scanner(System.in);
	public static void main(String[] args) {
//		int t=read();
//		while(t-->0) {
			solve();
//		}
	}
	static void solve() {
		String s=readS();
		int n=len(s);
		int start1=-1;
		boolean se=false;
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='[') {
				se=true;
			}
			if(se && s.charAt(i)==':') {
				start1=i;
				break;
			}
		}
		
		int start2=-1;
		se=false;
		for(int i=n-1;i>=0;i--) {
			if(s.charAt(i)==']') {
				se=true;
			}
			if(se && s.charAt(i)==':'){
				start2=i;
				break;
			}
		}
//		print(start1);
//		print(start2);
		if(start1==-1 || start2==-1 || start1>=start2) {
			println(-1);
			return;
		}
		int c=0;
		for(int i=start1;i<=start2;i++) {
			if(s.charAt(i)=='|') {
				c++;
			}
		}
		println(c+4);
	}
	static int[] sort(int a[]) {
		Arrays.sort(a);
		return a;
	}
	static String reverse(String s) {
		String res="";
		for(int i=s.length()-1;i>=0;i--) {
			res+=s.charAt(i);
		}
		return res;
	}
	static int gcd(int a,int b) {
		if(b==0) {
			return a;
		}
		return gcd(b,a%b);
	}
	static void swap(int a[],int i,int j) {
		int temp=a[i];
		a[i]=a[j];
		a[j]=temp;
	}
	static boolean contains(HashMap<Integer,Integer>hm,int ele) {
		return hm.containsKey(ele);
	}static boolean contains(HashMap<Character,Integer>hm,char ele) {
		return hm.containsKey(ele);
	}static int get(HashMap<Character,Integer>hm,char ele) {
		return hm.get(ele);
	}
	static char[] cha(String s) {
		return s.toCharArray();
	}
	static int len(String s) {
		return s.length();
	}
	static int len(int a[]) {
		return a.length;
	}
	static int len(long a[]) {
		return a.length;
	}
	static long abs(long a) {
		return Math.abs(a);
	}static int abs(int a) {
		return Math.abs(a);
	}
	static long min(long a,long b) {
		return Math.min(a, b);
	}static long max(long a,long b) {
		return Math.max(a, b);
	}
	static void print(int a) {
		System.out.print(a+" ");
	}static void print(long a) {
		System.out.print(a+" ");
	}static void print(String a) {
		System.out.print(a);
	}static void println(int a) {
		System.out.println(a);
	}static void println(long a) {
		System.out.println(a);
	}static void println(String a) {
		System.out.println(a);
	}
	static void println() {
		System.out.println();
	}
	static void println(char []c) {
		for(int i=0;i<c.length;i++) {
			System.out.print(c[i]);
		}
		println();
	}
	static int read() {
		return scr.nextInt();
	}
	static String readS() {
		return scr.next();
	}
	static long readL() {
		return scr.nextLong();
	}
	static int[]readIntArray(int n){
//		int n=read();
		int []a=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scr.nextInt();
		}
		return a;
	}static long[]readLongArray(int n){
		long []a=new long[n];
		for(int i=0;i<n;i++) {
			a[i]=scr.nextLong();
		}
		return a;
	}
	static void printArray(int a[]) {
		int n=a.length;
		for(int i=0;i<n;i++) {
			print(a[i]);
		}
	}
}