import java.util.*;
import java.io.*;
/**
 * Created by IntelliJ IDEA.
 * User: o_215
 * Date: 21.10.2009
 * Time: 17:35:28
 * To change this template use File | Settings | File Templates.
 */
public class D {
public static void main(String[] args) throws Exception{
    Scanner in=new Scanner(new File("computer.in"));
    PrintWriter out=new PrintWriter(new File("computer.out"));
    int count=0;
    char last='0';
    String S=in.next();
    int n=S.length();
    for (int i=0;i<n;i++){
        if (last!=S.charAt(i)){
            count++;last=S.charAt(i);
        }
    }
    out.println(count);
    in.close();
    out.close();
}
}
