import java.util.Scanner;
import java.io.File;
import java.io.PrintWriter;
import java.io.*;
import java.util.*;
/**
 * Created by IntelliJ IDEA.
 * User: m09kiv
 * Date: 21.10.2009
 * Time: 19:03:51
 * To change this template use File | Settings | File Templates.
 */
public class comp {
     public static void main(String[] ags) throws Exception{
        Scanner in = new Scanner(new File("computer.in"));
        PrintWriter out = new PrintWriter(new File("computer.out"));
        String s1=in.next();char k ='0';int j=0;
        for (int i=0;i<s1.length();i++) {
            if (s1.charAt(i)!=k){
               j++;k=s1.charAt(i);
            }
        }
         out.println(j);
         out.close();
         in.close();
     }
}
