import sys



s = sys.stdin.readline().rstrip()



def main():

    cnt = 0

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

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

            cnt += 1

    return cnt



if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



s = sys.stdin.readline().rstrip()



def main():

    prev = '$'

    cnt = -1

    for c in s:

        cnt += c != prev

        prev = c

    print(cnt)



if __name__ ==  '__main__':

    main()
import sys

s = sys.stdin.readline().rstrip()


def main():
    cnt = 0
    for i in range(len(s) - 1):
        if s[i] != s[i + 1]:
            cnt += 1
    return cnt


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

s = sys.stdin.readline().rstrip()


def main():
    prev = "$"
    cnt = -1
    for c in s:
        cnt += c != prev
        prev = c
    print(cnt)


if __name__ == "__main__":
    main()

-    cnt = 0 -    for i in range(len(s) - 1): -        if s[i] != s[i + 1]: -            cnt += 1 -    return cnt +    prev = "$" +    cnt = -1 +    for c in s: +        cnt += c != prev +        prev = c +    print(cnt) -    ans = main() -    print(ans) +    main()