program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: i,ans
    character(100000):: s
    character(1):: ns

    read*, s
    ns = s(1:1)
    ans=0
    do i=2,len_trim(s)
        if (s(i:i) /= ns) then
            ans=ans+1
            ns=s(i:i)
        end if
    end do

    print'(i0)', ans
end program name