from collections import defaultdict





def main():

    s = eval(input())

    ans = 0

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

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

            ans += 1

    print(ans)



if __name__ == '__main__':

    main()

from collections import defaultdict

from itertools import groupby





def main():

    S = eval(input())

    print((len([k for k, g in groupby(S)]) - 1))





if __name__ == '__main__':

    main()

from collections import defaultdict


def main():
    s = eval(input())
    ans = 0
    for i in range(len(s) - 1):
        if s[i] != s[i + 1]:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict
from itertools import groupby


def main():
    S = eval(input())
    print((len([k for k, g in groupby(S)]) - 1))


if __name__ == "__main__":
    main()

+from itertools import groupby -    s = eval(input()) -    ans = 0 -    for i in range(len(s) - 1): -        if s[i] != s[i + 1]: -            ans += 1 -    print(ans) +    S = eval(input()) +    print((len([k for k, g in groupby(S)]) - 1))