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

/**
 * Created by IntelliJ IDEA.
 * User: o_00
 * Date: 19.10.2009
 * Time: 15:49:33
 * To change this template use File | Settings | File Templates.
 */
public class Smile implements Runnable {
    final String fName = "smile";

    public void run() {
        try {
            Scanner in = new Scanner( new File( fName + ".in" ) );
            PrintWriter out = new PrintWriter( new File( fName + ".out" ) );
            String s = in.nextLine();
            int res = 0;
            for(int i = 0; i < s.length(); i++) {
                if ( s.charAt(i) == ':' || s.charAt(i) == ';' ) {
                    int j = i + 1;
                    while (j < s.length() && s.charAt(j) == '-') j++;
                    if (j < s.length() && ( s.charAt(j) == ')' || s.charAt(j) == '('
                                         || s.charAt(j) == '[' || s.charAt(j) == ']' ) )
                        res++;
                    i = j - 1;
                }
            }
            out.println(res);
            in.close();
            out.close();
        } catch ( Exception e ) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public static void main( String[] args ){
        new Thread( new Smile() ).start();
    }
}
