/**
 * Created by IntelliJ IDEA.
 * User: o_243
 * Date: 28.10.2009
 * Time: 18:33:23
 * To change this template use File | Settings | File Templates.
 */
import java.util.Scanner;
import java.io.PrintWriter;
import java.io.File;

public class smile {
    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.nextLine();
        int smile=0;
        int n=0;
        //System.out.println(s);
        for (int i=0;i<s.length();i++){
                if (s.charAt(i) == ':' || s.charAt(i) ==';'){
                   //System.out.println("found "+ i);
                    n = i + 1;
                    while (n < s.length() && s.charAt(n) == '-' ){
                        //System.out.println(" --- " + n);
                        n++;
                    }
                    if (n < s.length() && ( s.charAt(n)=='(' || s.charAt(n)==')' || s.charAt(n)=='[' || s.charAt(n) ==']') )
                    smile++;
            }



        }   out.print(smile);

                out.close();
                in.close();
            }
        }
