program prob4
    implicit none
    character(len=100005)::s
    integer::i, j, l, cnt
    read*, s
    l = len_trim(s)
    cnt = 0
    do i = 2, l
        if(s(i:i) .ne. s(i-1:i-1)) cnt = cnt + 1
    end do
    print*, cnt
    stop
end program