/**
 * Created by IntelliJ IDEA.
 * User: o_215
 * Date: 28.10.2009
 * Time: 17:59:59
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;

public class B {
public static void main(String[] args) throws Exception{
    Scanner in= new Scanner(new File("smile.in"));
    PrintWriter out=new PrintWriter(new File("smile.out"));
    char[] c=in.nextLine().toCharArray();
    int i=0;int res=0;
    while (i<c.length){
        if (c[i]==':'||c[i]==';'){
            i++;
            while (i<c.length && c[i]=='-'){i++;}
            if(i<c.length && c[i]!=':' & c[i]!=';'){
                char s=c[i];res++;
                while(i<c.length && s==c[i]){i++;}
            }
        } else{i++;}
    }
    out.println(res);
    in.close();
    out.close();
}
}
