def main():

    S = eval(input())

    ans = -1

    pre = ""

    for s in S:

        if pre != s:

            ans += 1

            pre = s

    print(ans)

    return





main()

def main():

    S = eval(input())

    print((S.count("WB") + S.count("BW")))

    return





main()

def main():
    S = eval(input())
    ans = -1
    pre = ""
    for s in S:
        if pre != s:
            ans += 1
            pre = s
    print(ans)
    return


main()

def main():
    S = eval(input())
    print((S.count("WB") + S.count("BW")))
    return


main()

-    ans = -1 -    pre = "" -    for s in S: -        if pre != s: -            ans += 1 -            pre = s -    print(ans) +    print((S.count("WB") + S.count("BW")))