/**
 * Created by IntelliJ IDEA.
 * User: m09bma
 * Date: 28.10.2009
 * Time: 17:19:45
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;
public class Smile {
    public static void main (String[] args) throws Exception{
        Scanner in = new Scanner (new File ("smile.in"));
        PrintWriter out =  new PrintWriter ("smile.out");
        String s = in.nextLine();
        int a = 0;
        for (int i = 0; i < s.length()-1; i++)
        {
            if ((s.charAt(i) == ':') || (s.charAt(i) == ';'))
            {
                int j = i+1;
                while ( ( j < (s.length()-1) ) && (s.charAt(j) == '-') ){
                    j++;
                }
                int k;
                int b = 0;
                k = j;
                if ((s.charAt(k) == ')') || (s.charAt(k) == '(')
                  ||(s.charAt(k) == ']') || (s.charAt(k) == '[')){
                    b++;
                }
                if ( b > 0) {
                    a = a+1;
                }
            }
        }
        out.print (a);
        out.close();
    }
}
