from collections import Counter,defaultdict

import sys,heapq,bisect,math,itertools,string,queue

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))



s = eval(input())

n = len(s)

cnt = 1

for i in range(n):

    if i == 0:

        tmp = s[i]

    else:

        if s[i] == tmp:

            continue

        cnt += 1

        tmp = s[i]

if s[i] != tmp:

    cnt += 1

print((cnt-1))

from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

from bisect import bisect_left,bisect_right 

import sys,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))



s = eval(input())

now = -1

res = -1

for x in s:

    if now != x:

        res += 1

        now = x

print(res)
from collections import Counter, defaultdict
import sys, heapq, bisect, math, itertools, string, queue

sys.setrecursionlimit(10**8)
mod = 10**9 + 7


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


def inpl_str():
    return list(sys.stdin.readline().split())


def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))


s = eval(input())
n = len(s)
cnt = 1
for i in range(n):
    if i == 0:
        tmp = s[i]
    else:
        if s[i] == tmp:
            continue
        cnt += 1
        tmp = s[i]
if s[i] != tmp:
    cnt += 1
print((cnt - 1))

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint

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


def inp():
    return int(sys.stdin.readline())


def inpl():
    return list(map(int, sys.stdin.readline().split()))


s = eval(input())
now = -1
res = -1
for x in s:
    if now != x:
        res += 1
        now = x
print(res)

-from collections import Counter, defaultdict -import sys, heapq, bisect, math, itertools, string, queue +from collections import Counter, defaultdict, deque +from heapq import heappop, heappush, heapify +from bisect import bisect_left, bisect_right +import sys, math, itertools, fractions, pprint +INF = float("inf") -def inpl_str(): -    return list(sys.stdin.readline().split()) - - -def inpln(n): -    return list(int(sys.stdin.readline()) for i in range(n)) - - -n = len(s) -cnt = 1 -for i in range(n): -    if i == 0: -        tmp = s[i] -    else: -        if s[i] == tmp: -            continue -        cnt += 1 -        tmp = s[i] -if s[i] != tmp: -    cnt += 1 -print((cnt - 1)) +now = -1 +res = -1 +for x in s: +    if now != x: +        res += 1 +        now = x +print(res)