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"));
        int number =0;
        String s = in.nextLine();

       for (int i = 0; i < s.length() ;i++)
        {
            if (s.charAt(i) == ':' || s.charAt(i) == ';' )
            {       i++;
                while (i<s.length() && s.charAt(i) == '-'){ i++; }


                if (i<s.length() && (s.charAt(i) == '[' || s.charAt(i) == ']' || s.charAt(i) == ')' ||s.charAt(i) == '(')) number++;
             }

        }

            out.print(number);

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

