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.*;

public class Main{
    public static void main(String[] args) throws Exception {
        new Main();
    }
    Main() throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String s=in.next();
        boolean f=false;int pos1=-1,pos2=-1;
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='[')f=true;
            else if(f&&s.charAt(i)==':'){
                pos1=i;break;
            }
        }
        f=false;
        for(int i=s.length()-1;i>=0;i--){
            if(s.charAt(i)==']')f=true;
            else if(f&&s.charAt(i)==':'){
                pos2=i;break;
            }
        }
        if(pos1<pos2&&pos1!=-1&&pos2!=-1){
            int cnt=4;
            for(int i=pos1+1;i<pos2;i++){
                if(s.charAt(i)=='|')cnt++;
            }
            out.println(cnt);
        }else out.println(-1);
        out.flush();
    }
}
class InputReader {
    private InputStreamReader reader;
    private char[] buf;
    private int len, now;

    public InputReader(InputStream stream) {
        reader = new InputStreamReader(stream);
        buf = new char[1024];
        len = 0;
        now = 0;
    }

    public String next() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        StringBuilder sb = new StringBuilder();
        while (!isSpaceChar(buf[now])) {
            sb.append(buf[now]);
            if (!move()) break;
        }
        return sb.toString();
    }

    public int nextInt() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        int ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isNum(buf[now])) ans = ans * 10 + buf[now] - '0';
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

    public String nextLine() throws IOException {
        if (!hasNextLine()) throw new NullPointerException();
        StringBuilder sb = new StringBuilder();
        while (buf[now] != '\n') {
            sb.append(buf[now]);
            if (!move()) return sb.toString();
        }
        now++;
        return sb.toString();
    }

    public long nextLong() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        long ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isNum(buf[now])) ans = ans * 10 + buf[now] - '0';
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

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

    public int nextHexInt() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        boolean x = false;
        if (buf[now] == '-') {
            x = true;
            if (!move()) throw new NumberFormatException();
        }
        int ans = 0;
        while (!isSpaceChar(buf[now])) {
            if (isHex(buf[now])) ans = ans * 16 + toHex(buf[now]);
            else throw new NumberFormatException();
            if (!move()) break;
        }
        return (x ? -1 : 1) * ans;
    }

    public char nextChar() throws IOException {
        if (!hasNext()) throw new NullPointerException();
        char tmp = buf[now];
        move();
        return tmp;
    }
    public int next(char[] s) throws IOException {
        if (!hasNext()) throw new NullPointerException();
        int len=0;
        while (!isSpaceChar(buf[now])&&len<s.length) {
            s[len++]=buf[now];
            if (!move()) break;
        }
        return len;
    }
    public boolean hasNext() throws IOException {
        return skip();
    }

    public boolean hasNextLine() throws IOException {
        return now < len || refill();
    }

    private boolean move() throws IOException {
        now++;
        return hasNextLine();
    }

    private boolean skip() throws IOException {
        if (!hasNextLine()) return false;
        while (isSpaceChar(buf[now])) {
            if (!move()) return false;
        }
        return true;
    }

    private boolean isSpaceChar(char c) {
        return !(c >= 33 && c <= 126);
    }

    private boolean isNum(char c) {
        return c >= '0' && c <= '9';
    }

    private boolean isHex(char c) {
        return c >= '0' && c <= '9' || c >= 'A' && c <= 'F';
    }

    private int toHex(char c) {
        if (c >= '0' && c <= '9') return c - '0';
        else return c - 'A' + 10;
    }

    private boolean refill() throws IOException {
        len = reader.read(buf);
        now = 0;
        return len > 0;
    }
}