import java.util.Scanner;
import java.io.File;
import java.io.PrintWriter;

/**
 * Created by IntelliJ IDEA.
 * User: m09fav
 * Date: 28.10.2009
 * Time: 17:19:39
 * To change this template use File | Settings | File Templates.
 */
public class sm {
    public static void main (String[]args) throws Exception{
        Scanner in = new Scanner (new File("smile.in"));
        PrintWriter out = new PrintWriter ("smile.out");
        String s1 = in.nextLine();
        char[]c1 = s1.toCharArray();
        int res = 0;
        for (int i=0; i<s1.length(); i++)  {
            boolean b = ((s1.charAt(i)==':') || (s1.charAt(i)==';'));
            if (b) {
                if(((i + 1 < s1.length())&& (s1.charAt(i+1)==')' || s1.charAt(i+1)=='(' || s1.charAt(i+1)=='[' || s1.charAt(i+1)==']')) ){
                 res = res+1;
                }
                else {
                    if ((i + 1 < s1.length())) {
                        while ((i + 1 < s1.length()) && c1[i+1]=='-') {
                            i=i+1;
                            if((i + 1 < s1.length()) && ( s1.charAt(i+1)==')' || s1.charAt(i+1)=='(' || s1.charAt(i+1)=='[' || s1.charAt(i+1)==']') ){
                                res = res+1;}
                        }
                    }
                }
            }
        }
        out.println(res);
        in.close();
        out.close();
    }
}
