/**
 * Created by IntelliJ IDEA.
 * User: m09dam
 * Date: 28.10.2009
 * Time: 17:17:38
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;
public class problem1_28_10_09 {
    public static void main (String [] args ) throws Exception{
        Scanner in = new Scanner(new File ("smile.in") );
        PrintWriter out = new PrintWriter(new File ("smile.out") );
        String s = in.next();
        char[] a = s.toCharArray();
        char[] b = new char[a.length];
        int j = 0;
        int k = 0;
        for(j=0;j<s.length();j++){
            if(a[j] != '-'){
                b[k] = a[j];
                k = k+1;
            }
        }
        int c = 0;
        for(j=0;j <= k-1;j++){
            if((b[j] == ':') || (b[j] == ';')){
                if( ( b[j+1] == '(' ) || ( b[j+1] == ')' ) || ( b[j+1] == '[' ) || ( b[j+1] == ']')){
                  c=c+1;
            }
            };
        }
        out.println(c);
        out.close();
        in.close();

    }
}
