# -*- coding: utf-8 -*-



# AtCoder Beginner Contest

# Problem C



if __name__ == '__main__':

    s = eval(input())

    count = 0

    previous = s[0]



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

        current = s[i]



        if previous != current:

            count += 1



        previous = current



    print(count)

# -*- coding: utf-8 -*-



# AtCoder Beginner Contest

# Problem C



if __name__ == '__main__':

    s = eval(input())

    count = 0



    # See:

    # https://beta.atcoder.jp/contests/abc047/submissions/1007244

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

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

            count += 1



    print(count)

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
    s = eval(input())
    count = 0
    previous = s[0]
    for i in range(1, len(s)):
        current = s[i]
        if previous != current:
            count += 1
        previous = current
    print(count)

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == "__main__":
    s = eval(input())
    count = 0
    # See:
    # https://beta.atcoder.jp/contests/abc047/submissions/1007244
    for i in range(len(s) - 1):
        if s[i] != s[i + 1]:
            count += 1
    print(count)

-    previous = s[0] -    for i in range(1, len(s)): -        current = s[i] -        if previous != current: +    # See: +    # https://beta.atcoder.jp/contests/abc047/submissions/1007244 +    for i in range(len(s) - 1): +        if s[i] != s[i + 1]: -        previous = current