import sys

input = sys.stdin.readline

S = list(input().rstrip())

N = len(S)

cnt = 0

for i in range(N-1):

    if S[i] != S[i+1]:

        cnt += 1

print(cnt)

    
import sys

input = sys.stdin.readline



s = input().rstrip()

cnt = 0

for i in range(len(s) - 1):

    if s[i] != s[i + 1]:

        cnt += 1

print(cnt)

import sys

input = sys.stdin.readline
S = list(input().rstrip())
N = len(S)
cnt = 0
for i in range(N - 1):
    if S[i] != S[i + 1]:
        cnt += 1
print(cnt)

import sys

input = sys.stdin.readline
s = input().rstrip()
cnt = 0
for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        cnt += 1
print(cnt)

-S = list(input().rstrip()) -N = len(S) +s = input().rstrip() -for i in range(N - 1): -    if S[i] != S[i + 1]: +for i in range(len(s) - 1): +    if s[i] != s[i + 1]: