read S
BB=`echo $S | sed -e 's/WB//g'`
CC=`echo $S | sed -e 's/BW//g'`
ans1=$((${#S} - ${#BB}))
ans2=$((${#S} - ${#CC}))

if [ $ans1 -ne 0 ]
then
	ans1=$((ans1 / 2))
fi
if [ $ans2 -ne 0 ]
then
	ans2=$((ans2 / 2))
fi
echo $((ans1 + ans2))
