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



/**
 * Created by IntelliJ IDEA.
 * User: m09cke
 * Date: 21.10.2009
 * Time: 17:10:40
 * To change this template use File | Settings | File Templates.
 */
public class Main {
    public static void main(String[] args)throws FileNotFoundException{
        Scanner in = new Scanner(new File("computer.in"));
        PrintWriter out = new PrintWriter("computer.out");
        /*String f=in.next();
        String s=in.next();
        char first[]=new char[355];
        char second[]=new char[355];
        for (int i=0;i<f.length();i++){
            first[i]=s.charAt(i);
        }
        for (int i=0;i<s.length();i++){
            second[i]=s.charAt(i);
        }
        Arrays.sort(first);
        Arrays.sort(second);
        boolean t=true;
        if (f.length()==s.length()){
            for(int i=0;i<s.length();i++){
                if (first[i]!=second[i]) {t=false;}
                out.println(first[i]+" "+second[i]);
            }
        }
        else
        t=false;
        if (t==true) out.print("YES");
        else out.print("No");*/

        /*while (in.hasNext()){
            String s=in.next();
            out.println(s);
        } */
        /*String s = in.next();
        String v = in.next();
        int k=0;
        for (int i=0;i<s.length()-v.length()+1;i++){
            boolean t=true;
            for (int j=0;j<v.length();j++){
                if (s.charAt(i+j)!=v.charAt(j)) t=false;
            }
            if (t==true)k++;
        }
        out.print(k);*/

        String n=in.next();
        int m=0;
        for (int i=1;i<n.length();i++){
            if (n.charAt(i)!=n.charAt(i-1)) m++;
        }
        out.print(m);
        out.close();
    }
}
