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()-1; i++)  {
            boolean b = ((s1.charAt(i)==':') || (s1.charAt(i)==';'));
            if (b) { if(s1.charAt(i+1)==')' || s1.charAt(i+1)=='(' || s1.charAt(i+1)=='[' || s1.charAt(i+1)==']'){
                 res = res+1;
            }
                else {while (c1[i+1]=='-') {i=i+1; if(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();
}
}
