implicit none
integer :: i,n,ans
character(100000) :: s
character(1) :: t

read *,s
n = len_trim(s)

t = s(1:1)
ans = 0
do i = 2, n
   if (s(i:i) /= t) then
      ans = ans + 1
      t = s(i:i)
   endif
enddo

print '(i0)',ans
end