Problem:
 Score : 300 points    Problem Statement Two foxes Jiro and Saburo are playing a game called 1D Reversi . This game is played on a board, using black and white stones. On the board, stones are placed in a row, and each player places a new stone to either end of the row. Similarly to the original game of Reversi, when a white stone is placed, all black stones between the new white stone and another white stone, turn into white stones, and vice versa.  In the middle of a game, something came up and Saburo has to leave the game. The state of the board at this point is described by a string S . There are |S| (the length of S ) stones on the board, and each character in S represents the color of the i -th ( 1 ≦ i ≦ |S| ) stone from the left. If the i -th character in S is B , it means that the color of the corresponding stone on the board is black. Similarly, if the i -th character in S is W , it means that the color of the corresponding stone is white.  Jiro wants all stones on the board to be of the same color. For this purpose, he will place new stones on the board according to the rules. Find the minimum number of new stones that he needs to place.      Constraints  1 ≦ |S| ≦ 10^5  Each character in S is B or W .         Input The input is given from Standard Input in the following format:  S       Output Print the minimum number of new stones that Jiro needs to place for his purpose.        Sample Input 1 BBBWW      Sample Output 1 1  By placing a new black stone to the right end of the row of stones, all white stones will become black. Also, by placing a new white stone to the left end of the row of stones, all black stones will become white.  In either way, Jiro's purpose can be achieved by placing one stone.       Sample Input 2 WWWWWW      Sample Output 2 0  If all stones are already of the same color, no new stone is necessary.       Sample Input 3 WBWBWBWBWB      Sample Output 3 9

Solution (Python):
from itertools import groupby
S = input()
G = groupby(S)
print(len(list(G))-1)

Solution (Python):
S = input()
N =len(S)
cnt = 0

if N == 1:
    print(0)
else:
    for i in range(1,N):
        if S[i-1] != S[i]:
            cnt+= 1
    print(cnt)

Solution (Python):

S = input()
N = len(S)
c = S[0]
cnt = 0 
for i in range(1,N):
    if S[i] != c:
        cnt += 1
        c = S[i]

print(cnt)

Solution (Python):

S = input()
N = len(S)

def reversi(S):
    c = S[0]
    Flg = True
    cnt = 0
    for i in range(1,N):
        if Flg:
            if S[i] != c:
                
                Flg = False
        else:
            if S[i] == c:
                cnt += 1
                Flg = True
    
    if Flg:
        return cnt * 2
    else:
        return cnt * 2 + 1
print(reversi(S))

Solution (Python):
from itertools import groupby
S = list(input())

s = groupby(S)
ans = []
for key, group in s:
    ans.append(key)
print(len(ans)-1)

Solution (Python):
from itertools import groupby
S=input()
G=groupby(S)
print(len(list(G))-1)

Solution (Python):
S = input()
cnt = 0
for i in range(1, len(S)):
    if S[i -1] != S[i]:
        cnt += 1

print(cnt)

Solution (Python):
s = input()
ans = 0
for s1, s2 in zip(s, s[1:]):
  if s1 != s2:
    ans += 1
print(ans)

Solution (Python):
s=str(input())
cnt=0
l=len(s)
for i in range(l):
  if i==0:
    prev=s[i]
  else:
    nex=s[i]
    if nex!=prev:
      cnt+=1
    prev=nex
print(cnt)

Solution (Python):
s = input()

x = 0
for i in range(len(s) - 1):
    if s[i] != s[i+1]:
        x += 1

print(x)

Solution (Python):
s = input()

x = s[0]
for i in range(1, len(s)):
    if s[i-1] != s[i]:
        x += s[i]

print(len(x) - 1)

Solution (Python):
S = [s for s in input()]
x = S.pop(0)
counter = 0 

while S:
  y = S.pop(0)
  if x!=y:
    counter += 1
    x = y

print(counter)

Solution (Python):
s=input()
for i in range(10**2):
  s=s.replace('WW','W').replace('BB','B')
print(len(s)-1)

Solution (Python):
s = input()

flag = s[0]
cnt = 0
for c in s:
    if flag == c:
        continue
    else:
        cnt+=1
        flag = c

print(cnt)

Solution (Python):
S = input()

ans = 0
for i in range(len(S) - 1):
    if not S[i] == S[i + 1]:
        ans += 1

print(ans)

Solution (Python):
import sys

 
def main():
    s = input()
    l = len(s)
    
    count = 0
    for i in range(l-1):
        if s[i] != s[i+1]:
            count += 1
            
    print(count)
    
if __name__ == "__main__":
    main()

Solution (Python):
s = input()
ans = 0
if len(s) == 1:
         print(0)
         exit()
for i in range(1,len(s)):
         if s[i] != s[i-1]:
                  ans += 1
print(ans)

Solution (Python):
S = input()
n = len(S)

i = 1

ans = 0

while i < n:
    if S[i - 1] != S[i]:
        ans += 1
    i += 1
print(ans)

Solution (Python):
S = input()
New_S = []
for i in range(1,len(S)):
    if S[i-1] != S[i]:
        New_S.append(S[i-1])
New_S.append(S[-1])
print(len(New_S)-1)

Solution (Python):


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    S=input()
    N=len(S)
    a=S[0]
    ans=0
    for i in range(N):
        if S[i]!=a:
            ans+=1
            a=S[i]
            
    print(ans)

main()

Solution (Python):


S = input().strip()


cnt=0
for i in range(len(S)-1):
    if S[i] != S[i+1]:
        cnt += 1

print(cnt)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
r = 0

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

Solution (Python):
s = input()

ic = s[0]
ans = 0
for c in s:
    if c != ic:
        ans += 1
        ic = c

print(ans)

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(n-1):
    if s[i+1] != s[i]:
        ans += 1
print(ans)

Solution (Python):
S = input()

ban = []
prev = None
for s in S:
    if s == prev:
        continue
    else:
        ban.append(s)
        prev = s

print(len(ban) - 1)

Solution (Python):
from itertools import groupby
print(len(list(groupby(input()))) - 1)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline

s = readline().rstrip().decode('utf-8')

if len(s) == 1:
    print(0)
    exit()

res = 0
for i in range(1,len(s)):
    if s[i] != s[i-1]:
        res += 1


print(res)

Solution (Python):
s = list(input())
ans = 0

for i in range(len(s)-1):
    if s[i] == 'B' and s[i+1] == 'W':
        ans += 1
    elif s[i] == 'W' and s[i+1] == 'B':
        ans += 1
print(ans)

Solution (Python):
s = input()
c = 1
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        c+=1
print(c-1)

Solution (Python):
S = input()
t = S[0]
ans = 0
for k in range(1,len(S)):
    if t != S[k]:
        ans += 1
        t = S[k]
print(ans)

Solution (Python):
S = input()
c=1
for i in range(len(S)-1):
  if S[i]!=S[i+1]:
    c+=1
print(c-1)

Solution (Python):
S = input()
ans = 0
is_started = False
is_w = False
for s in S:
    if not is_started:
        is_w = True if s == 'W' else False
        is_started = True
    else:
        if s == 'W':
            if not is_w:
                ans += 1
            is_w = True
        else:
            if is_w:
                ans += 1
            is_w = False
print(ans)

Solution (Python):
s = input()
sw = 0
bef = s[0]

for i in s:
    if (bef != i):
        bef = i
        sw+=1
print(sw)

Solution (Python):
s=input()
pre = s[0]
ans = 0
for c in s[1:]:
  if c != pre:
    ans += 1
    pre = c
print(ans)

Solution (Python):
S = str(input())

trans = 0
for i in range(len(S) - 1):
  if S[i] != S[i+1]:
    trans += 1
print(trans)

Solution (Python):
S = input()
islands = 1
for ix, s in enumerate(S):
    if ix == 0:
        tmp = s
    else:
        if s != tmp:
            islands += 1
            tmp = s
        else:
            pass

print(islands - 1)

Solution (Python):

from itertools import groupby
s=input()
g=groupby(s)
print(len(list(g))-1)

Solution (Python):
a=input()
a=list(a)
ans=0
for i in range(len(a)-1):
	if a[i]=='W':
		if a[i+1]=='B':
			ans=ans+1
	if a[i]=='B':
		if a[i+1]=='W':
			ans=ans+1
print(ans)

Solution (Python):
s = input()

ans = 0

for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        ans += 1

print(ans)

Solution (Python):
s = input()
c = 0
for i in range(0, len(s)-1):
    if s[i:i+2] == "BW" or s[i:i+2] == "WB":
        c += 1
print(c)

Solution (Python):
def runLength(str):
    """文字列strをランレングス圧縮して返す関数
    ex: "0000111101" => [(0,4), (1,4), (0,1), (1,1)]
    """
    res = []
    data, count = str[0], 1
    for i in range(1, len(str)):
        if str[i] == data:
            count += 1
        else:
            res.append((data, count))
            data, count = str[i], 1
    res.append((data, count))
    return res


S = input()
print(len(runLength(S)) - 1)

Solution (Python):
s = input()
ans = 0
w = s[0]
for i in range(len(s)):
    if s[i] == w: continue
    else:
        w = s[i]
        ans += 1
print(ans)

Solution (Python):
S = input()

if S[0] == 'W':
    count = 0
    f = 0
    for i in range(len(S)):
        if S[i] == 'W' and f == 1:
            f = 0
            count += 1
        elif S[i] == 'B' and f == 0:
            f = 1
            count += 1
else:
    f = 0
    count = 0
    for i in range(len(S)):
        if S[i] == 'B' and f == 1:
            f = 0
            count += 1
        elif S[i] == 'W' and f == 0:
            f = 1
            count += 1

print(count)

Solution (Python):
s=input()
s1=s[0]
cnt=0
for i in range(len(s)):
    if s[i] != s1:
        cnt += 1
        s1 = s[i]
print(cnt)

Solution (Python):


s = input()

l = [0 if s[i] == s[i+1] else 1 for i in range(len(s)-1)]
print(sum(l))

Solution (Python):
S = input()
cur = S[0]
ans = 0
for ch in S:
    if cur != ch:
        cur = ch
        ans += 1
print(ans)

Solution (Python):
count = 0
s = input()
for i in range(1, len(s)):
    if s[i] != s[i-1]:
        count += 1
print(count)

Solution (Python):
s = list(input())
prev = s[0]
section = 0
for i in s[1:]:
    if i != prev:
        section += 1
    prev = i
print(section)

Solution (Python):
s = input()
ans = 0
old = s[0]
for i in range(1, len(s)):
    if old != s[i]:
        ans += 1
    old = s[i]
print(ans)

Solution (Python):
S=input()
cnt=0

for i in range(1,len(S)):
  if S[i]!=S[i-1]:
    cnt+=1
    
print(cnt)

Solution (Python):
S = input()

ans = 0
for i in range(len(S)-1) :
    if S[i] != S[i+1] :
        ans += 1

print(ans)

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(n-1):
    if s[i] != s[i+1]:
        ans += 1
print(ans)

Solution (Python):
s = input()

def run_length_compress(string):
    """文字列をランレングス圧縮する
    例) string = "aabccaaabb" -> [(2, a), (1, b), (2, c), (3, a), (2, b)]
    """
    string = string + "@" 
    n = len(string)

    begin = 0
    end = 1
    cnt = 1
    ans = []
    while True:
        if end >= n:
            break
        if string[begin] == string[end]:
            end += 1
            cnt += 1
        else:
            ans.append((cnt, string[begin]))
            begin = end
            end = begin + 1
            cnt = 1

    return ans
  
print(len(run_length_compress(s)) - 1)

Solution (Python):
from itertools import groupby as gb

s = list(input())
g = gb(s)

print(len(list(g)) - 1)

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

Solution (Python):
S = input()
count = 0
check = S[0]

for i in S[1:]:
    if check != i:
        count+=1
        check = i
        
print(count)

Solution (Python):
S = input()
now = S[0]
cnt = 0
for s in S:
  if s != now:
    cnt += 1
    now = s
print(cnt)

Solution (Python):
from collections import deque
import sys
input = sys.stdin.readline
import bisect as bi

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


main()

Solution (Python):
s = list(input())
ans = 0
for i in range(len(s) - 1):
    if s[i] != s[i + 1]:
        ans += 1
print(ans)

Solution (Python):



from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe




def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)
def debug(*args):
    print(*args,file=sys.stderr)

def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)

def pin(type=int):
    return map(type,input().split())
     


                
def resolve():
    s=input()
    ans=0
    for char in range(1,len(s)):
        ans+=s[char]!=s[char-1]
    print(ans)
        


"""


"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """BBBWW"""
        output = """1"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """WWWWWW"""
        output = """0"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """WBWBWBWBWB"""
        output = """9"""
        self.assertIO(input, output)

if __name__=="__main__":resolve()

Solution (Python):
S=input()
count=0
words=list(S)
n=len(words)-1
for a in range(n):
    if words[a]==words[a+1]:
        pass
    else:
        count+=1
print(count)

Solution (Python):
S = str(input())

counting = 0

for i in range(len(S)-1):
    if S[i] != S[i+1]:
        counting+=1
print(counting)

Solution (Python):
s = input()
print(s.count('BW') + s.count("WB"))

Solution (Python):
s = input()
prev = ans = -1
for c in s:
    if prev != c:
        prev = c
        ans += 1
print(ans)

Solution (Python):
S = input()

last = ""
ls = []
for s in S:
    if s != last:
        last = s
        ls.append(s)
    else:
        ls[-1] += s

print(len(ls)-1)

Solution (Python):
s = list(input())
ans = 0
prestr = s[0]
for id in range(len(s) - 1):
    if prestr == s[id + 1]: continue
    else: 
        ans += 1
        prestr = s[id + 1]
print(ans)

Solution (Python):

S=list(input())
f=0
for i in range(len(S)-1):
    if S[i]!=S[i+1]:
        f+=1
print(f)

Solution (Python):
s = input()
ans = 0
chk = s[0]
if len(s) == 1:
    print(0)
    exit()
for i in range(1, len(s)):
    if s[i] == chk:
        pass
    else:
        ans += 1
        chk = s[i]
    
print(ans)

Solution (Python):
S = input()

ans = 0

before_color = ''

for i, char in enumerate(S):
    if i == 0:
        before_color = char
        continue
    
    
    if char == before_color:
        continue
    
    
    ans += 1
    before_color = char
    
print(ans)

Solution (Python):
s = input()
ans = 0
for i in range(1, len(s)):
    if s[i] != s[i - 1]: ans += 1
print(ans)

Solution (Python):
s = input()
p = s[0]
c = 0
for i in range(1, len(s)):
    if p != s[i]:
        c += 1
        p = s[i]
print(c)

Solution (Python):
S=input()
cnt=0
for i in range(len(S)-1):
  if S[i]!=S[i+1]:
    cnt+=1
print(cnt)

Solution (Python):
def c_1d_reversi():
    
    
    from itertools import groupby
    return len(list(groupby(input()))) - 1

print(c_1d_reversi())

Solution (Python):
def main():
  s = input()
  if set(s) == 1:
    print(0)
    exit()
  group_count = 1
  v = s[0]
  for i in range(1, len(s)):
    if v == s[i]:
      continue
    group_count += 1
    v = s[i]
  print(group_count-1)
    
  

def input_list():
  return map(int, input().split())

import math
main()

Solution (Python):
s = input()
t = 0
for i in range(len(s) - 1):
    if s[i] != s[i+1]:
        t += 1

print(t)

Solution (Python):
def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

s=groupby(input())
print(len(s)-1)

Solution (Python):
def main():
    board = input()
    answer = 0
    series = board[0]
    for b in board:
        if not series == b:
            series = b
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
cnt=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]: cnt+=1
print(cnt)

Solution (Python):
s=input()
cnt=0
n=len(s)
for i in range(n-1):
    if s[i]=='B' and s[i+1]=='W':
        cnt+=1
    elif s[i]=='W' and s[i+1]=='B':
        cnt+=1
print(cnt)

Solution (Python):
def I(): return int(input())
def MI(): return map(int, input().split())
def LMI(): return list(map(int, input().split()))
MOD = 10 ** 9 + 7


S = input()
cnt1 = 0
cur = S[0]
for c in S:
    if cur != c:
        cnt1 += 1
        cur = c

cnt2 = 0
cur = S[-1]
for c in reversed(S):
    if cur != c:
        cnt2 += 1
        cur = c

print(min(cnt1, cnt2))

Solution (Python):
S = input()
w = S.split('B')
w = [x for x in w if x != '']
b = S.split('W')
b = [x for x in b if x != '']

print(len(w)+len(b)-1)

Solution (Python):
import re

s = input()

s = re.sub(r"([BW])\1*(?!\1)", r"\1", s)

print(int(len(s) - 1))

Solution (Python):
s = input()
ans = 0
t = s[0]
for c in s:
    if c != t:
        ans += 1
    t = c
print(ans)

Solution (Python):
s = input()
count = 0
sta = s[0]
for i in s:
  if i != sta:
    count += 1
    sta = i
print(count)

Solution (Python):
from itertools import groupby
s = input()
gr = groupby(s)
print(len(list(gr)) - 1)

Solution (Python):
S = input()
s = S[0]
ret = 0
for x in S:
    if s != x:
        ret += 1
        s = x
print(ret)

Solution (Python):
s=input()
cnt=0
for i in range(1,len(s)):
    if s[i-1]!=s[i]:
        cnt+=1
print(cnt)

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

Solution (Python):
s = list(input())

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

Solution (Python):
s = input()

color = s[0]
ans = 0
for c in s:
    if color != c:
        color = c
        ans += 1
print(ans)

Solution (Python):
S=input()
cnt=0
for i in range(len(S)-1):
    if(S[i+1]!=S[i]):
        cnt+=1
print(cnt)

Solution (Python):
s = input()
n = s[0]
count = 0
for i in s[1:]:
    if n != i:
        n = i
        count += 1

print(count)

Solution (Python):
s = input()

c = s[0]
m = 0

for i in s:
    if c != i:
        c = i
        m += 1
        
print(m)

Solution (Python):
S = input()
src = S[0]
ans = 0
for dst in S:
    if(dst != src):
        ans += 1
        src = dst
print(ans)

Solution (Python):


S = list(input())

first = S[0]

count = 0
for str in S:
  if str != first:
    count += 1
  first = str
  
print(count)

Solution (Python):
from collections import defaultdict
d = defaultdict(int)

S = input()
ans = 0
tmp = S[0]

for s in S:
  d[s] += 1

  if s != tmp:
    ans += 1

  tmp = s

if len(d) == 1:
  print(0)
else:
  print(ans)

Solution (Python):
S = input()
ans = 0
for i in range(len(S) - 1):
    if S[i] != S[i + 1]:
        ans += 1
print(ans)

Solution (Python):

import sys
INF = float("inf")


def Run_length_encoding(S: str):
    ans = []
    curr = S[0]
    counter = 0
    for c in S:
        if c == curr:
            counter += 1
        else:
            ans.append((curr, counter))
            curr = c
            counter = 1
    ans.append((curr, counter))
    return ans


def solve(S: str):
    rle = Run_length_encoding(S)
    print(len(rle)-1)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  
    solve(S)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(n-1):
  if s[i] != s[i+1]:
    ans += 1
print(ans)

Solution (Python):
s = list(input())
x = s[0]
ansl = [s[0]]
for i in range(1,len(s)):
    
    if s[i] == x:
        pass
    else:
        ansl.append(s[i])
        x = s[i]
print(len(ansl)-1)

Solution (Python):
s=input()
count=0
for i in range(0,len(s)-1):
	if s[i]!=s[i+1]:
		count+=1
print(count)

Solution (Python):
s = input()

f = s[0]
ans = 0

for i in range(1,len(s)):
    if s[i] != f:
        ans += 1
        f = s[i]

print(ans)

Solution (Python):
S = str(input())
c = 0
for i in range(1, len(S)):
    if S[i-1] != S[i]:
        c += 1
print(c)

Solution (Python):
S = input()
ans = 0

now = "?"
for s in S:
    if now == s:
        continue
    ans += 1
    now = s

print(ans-1)

Solution (Python):
S = input()
count = 0
s1 = S[0]
for i in range(1,len(S)):
    if s1 != S[i]:
        count += 1
    
    s1 = S[i]
print(count)

Solution (Python):
S = input()
c = 0
for k in range(1,len(S)):
    if S[k-1] != S[k]:
        c += 1
print(c)

Solution (Python):
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
s=input()
cur=s[0]
counter=1
for i,ss in enumerate(s):
    if i==0:
        continue
    if ss!=cur:
        counter+=1
        cur=ss
print(counter-1)

Solution (Python):
S = input()
ans = 0

now = "?"
for s in S:
    if now == s:
        continue
    ans += 1
    now = s

print(ans-1)

Solution (Python):
s=input()

cnt=0
current=s[0]
for i in range(1,len(s)):
    if current!=s[i]:
        cnt+=1
        current=s[i]
print(cnt)

Solution (Python):


s = input()
cnt = 0
for i in range(len(s)-1):
    if s[i] != s[i+1]: cnt += 1
print(cnt)
"""
for i in range(len(s)-1):
    if s[i] != s[i+1]: cnt += 1
print(cnt)"""

Solution (Python):
def main():
    S = input()
    N = len(S)
    ans = 0
    for i in range(1, N):
        if S[i-1] != S[i]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
N = len(s)
c = 0
for i in range(N-1):
  if s[i]!=s[i+1]:
    c += 1
print(c)

Solution (Python):
S = list(input())
N = len(S)
tmp = 0
for i in range(1, N):
    if S[i] != S[i-1]:
        tmp += 1
print(tmp)

Solution (Python):
S = input()
ans = len([1 for a,b in zip(S,S[1:]) if a!=b])
print(ans)

Solution (Python):
S = input()

ans = 0
for i in range(len(S)-1):
    if S[i+1] != S[i]:
        ans += 1

print(ans)

Solution (Python):
s = input()
n = len(s)
ans = 0
for i in range(n-1):
    if s[i] != s[i+1]:
        ans += 1
print(ans)

Solution (Python):
S=input()
count=0
for i in range(len(S)-1):
    if S[i]!=S[i+1]:
        count+=1
print(count)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    before = " "
    RLE = []
    for s in S:
        if before != s:
            RLE.append(s)
        before = s
    print(len(RLE)-1)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
read=sys.stdin.readline

S=list(read())
del S[-1]

ans,buf=-1,''
for s in S:
    if buf!=s:
        ans+=1
        buf=s
print(ans)

Solution (Python):
S = list(input())
n = len(S)
count = 1
for i in range(1,n):
    if S[i-1] != S[i]:
        count+=1
print(count-1)

Solution (Python):
s = list(input())

r = 0
color = s[0]
for stone in s:
  if stone != color:
    color = stone
    r += 1

print(r)

Solution (Python):
from itertools import groupby
S=input()
G=groupby(S)
print(len(list(G))-1)

Solution (Python):
def run_length(data, init=''):
    length = []
    tmp = init
    cnt = 0
    for c in data:
        if tmp != c:
            length.append(cnt)
            cnt = 0
        tmp = c
        cnt += 1
    length.append(cnt)
    return length

s = input()
rev = run_length(s)

print(len(rev) - 2)

Solution (Python):
S = input()
tmp = S[0]
cnt = 0
for i in range(1,len(S)):
	if S[i] != tmp:
		cnt += 1
		tmp = S[i]
print(cnt)

Solution (Python):
S = list(input())
i = 0
count = 0
for i in range(len(S)-1):
  if S[i] != S[i+1]:
    count+=1
  
print(count)

Solution (Python):
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

S=one_str()

count=0
list_S = list(S)
old = list_S[0]
for i in range(1,len(list_S)):
    if old != list_S[i]:
        count+=1
    old = list_S[i]

print(count)

Solution (Python):
S = input()

ans = 0
prev = S[0]
for i in range(len(S)):
    if S[i] == prev:
        continue
    ans += 1
    prev = S[i]

print(ans)

Solution (Python):
def run_length(s) -> list:
  res = [[s[0], 1]]
  for i in range(1, len(s)):
    if res[-1][0] == s[i]:
      res[-1][1] += 1
    else:
      res.append([s[i], 1])
  return res

R = run_length(input())
print(len(R) - 1)

Solution (Python):
import re
s = input()
wb = re.findall("WB", s)
bw = re.findall("BW", s)
print(len(wb+bw))

Solution (Python):
S = input()
while "WW" in S:
  S = S.replace("WW", "W")
while "BB" in S:
  S = S.replace("BB", "B")
print(len(S)-1)

Solution (Python):
from itertools import groupby
print(len(list(groupby(input())))-1)

Solution (Python):
s = input()

c = []
f = s[0]
count = 1
for si in list(s):
  if f != si:
    count += 1
    c.append(count)
    f = si
  else:
    c.append(count)

stone_count = len(set(c))
if stone_count == 2:
  print(1)
  exit()

if stone_count == 1:
  print(0)
  exit()
  
print(stone_count - 1)

Solution (Python):
S=input()
cnt=0
for i in range(len(S)-1):
  if S[i]!=S[i+1]:
    cnt+=1
print(cnt)

Solution (Python):
s = input()
key = s[0]
count = 0
for i in range(1,len(s)):
    if key != s[i]:
        count += 1
        key = s[i]
print(count)

Solution (Python):
s = input()

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

Solution (Python):
S = input()
ans = 0
coller = S[0]
for s in S[1:]:
    if s != coller:
        ans += 1
        coller = s
print(ans)

Solution (Python):

S = input()

ans = 0
tmp = None
for s in S:
  if tmp == None:
    tmp = s
  else:
    if tmp != s:
      ans += 1
      tmp = s

print(ans)

Solution (Python):
r = ""
c = 0
for s in input():
  if s != r:
    c += 1
    r = s
print(c - 1)

Solution (Python):

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

Solution (Python):
S=input()
current=S[0]
if len(S)==1:
    print(0)
else:
    cnt=0
    for w in S[1:]:
        if w==current:
            cnt+=0
        else:
            cnt+=1
        current=w
    print(cnt)

Solution (Python):
s=input()
ans=[]
for i in range(len(s)-1):
	if s[i] != s[i+1]:
		ans.append(s[i])
ans.append(s[-1])
print(len(ans)-1)

Solution (Python):
import sys

if sys.platform =='ios':
	sys.stdin=open('input_file.txt')
	

s=list(input().strip())
count=0
prev=s[0]
for c in s[1:]:
	if c != prev:
		count += 1
		prev = c
print(count)

Solution (Python):
s=list(input())
ans=0
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    ans+=1
print(ans)

Solution (Python):
s = input()

ans = 0
tmp = s[0]

for i in range(1,len(s)):
    if s[i] != tmp:
        ans += 1
        tmp = s[i]

print(ans)

Solution (Python):
S = input()

res=0
last_c=S[0]
for tmp in S:
    if tmp != last_c:
        res+=1
    last_c=tmp
print(res)

Solution (Python):
S = input()

count = 0
for i in range(len(S)-1):
    if S[i] != S[i+1]:
        count += 1

print(count)

Solution (Python):
a=input()
cnt=0
for i in range(len(a)-1):
  if(a[i]!=a[i+1]):
    cnt+=1
print(cnt)

Solution (Python):
s = input()
c = 1
f = False

for i in range(len(s)-1):
    if s[i] != s[i+1]:
        c += 1
print(c-1)

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    S = input().strip()
    s = S[0]
    ans = 0
    for i in range(1, len(S)):
        if s != S[i]:
            ans += 1
            s = S[i]

    print(ans)




if __name__ == '__main__':
    main()

Solution (Python):
S = input()
count = 0
for i in range(1,len(S)):
    if S[i] != S[i-1]:
        count += 1
print(count)

Solution (Python):
BW=input()
BF=BW[0]
LS=[BW[0]]
for s in BW:
  if BF != s:
    LS.append(s)
    BF=s
print(len(LS)-1)

Solution (Python):
def solve(s):
    prev = ''
    count = 0
    for c in s:
        if prev != c:
            count += 1
        prev = c
    return count - 1

_s = input()
print(solve(_s))

Solution (Python):
S = input()
flag =S[0]
counter = 0
for i in range(len(S)-1):
  if S[i+1] != flag:
    counter += 1
    flag = S[i+1]
print(counter)

Solution (Python):
S = input()
print(S.count("BW") + S.count("WB"))

Solution (Python):
S = input()

ans = 0

for i in range(1, len(S)):
    if S[i - 1] != S[i]:
        ans += 1

print(ans)

Solution (Python):
def main():
    S=input()
    c=0
    now=S[0]
    for s in S:
        if s!=now: c += 1
        now = s
    print(c)
main()

Solution (Python):
s = list(input())

count = 0
for i in range(len(s)-1):
  if s[i] != s[i+1]:
    count += 1

print(count)

Solution (Python):
s=list(input())
ans=0
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    ans+=1
print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

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

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    line = S()
    unique = line[0]
    for c in line:
        if c != unique[-1]:
            unique += c
    print(len(unique)-1)

main()

Solution (Python):
s=input()
cnt=0
tmp=s[0]
for x in s:
    if tmp!=x:
        cnt+=1
    tmp=x
print(cnt)

Solution (Python):
s = input()

ans = 0
prev = s[0]
for i in s:
    if i != prev:
        ans +=1
    prev = i
    
print(ans)