import java.util.*;
import java.io.*;

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();
        char[] c = s.toCharArray();
        int len = s.length();

        int i =0, cnt = 0;
        while(i < len){
          while((i < len) && (c[i]!=':') && (c[i]!=';'))
            i++;
          if(i != len){
             while((i < len) && (c[i]!='[') && (c[i]!=']')&& (c[i]!='(') && (c[i]!=')'))
               i++;
             if(i!=len)
               cnt++;
          }
        }
        out.print(cnt);
        in.close();
        out.close();
    }
}
