s = eval(input())



S = []

for i in range(len(s)):

    if i == 0:

        S.append(s[i])

    else:

        if S[-1] != s[i]:

            S.append(s[i])



print((len(S) - 1))
import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    s = eval(input())

    n = len(s)



    res = 0

    for i in range(1, n):

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

            res += 1

    print(res)





if __name__ == '__main__':

    resolve()

s = eval(input())
S = []
for i in range(len(s)):
    if i == 0:
        S.append(s[i])
    else:
        if S[-1] != s[i]:
            S.append(s[i])
print((len(S) - 1))

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    s = eval(input())
    n = len(s)
    res = 0
    for i in range(1, n):
        if s[i - 1] != s[i]:
            res += 1
    print(res)


if __name__ == "__main__":
    resolve()

-s = eval(input()) -S = [] -for i in range(len(s)): -    if i == 0: -        S.append(s[i]) -    else: -        if S[-1] != s[i]: -            S.append(s[i]) -print((len(S) - 1)) +import sys + +sys.setrecursionlimit(10**7) +f_inf = float("inf") +mod = 10**9 + 7 + + +def resolve(): +    s = eval(input()) +    n = len(s) +    res = 0 +    for i in range(1, n): +        if s[i - 1] != s[i]: +            res += 1 +    print(res) + + +if __name__ == "__main__": +    resolve()