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):
a=list(input())
a.append("A")
cnt=0
for i in range(len(a)-1):
    if a[i]!=a[i+1]:
        cnt+=1
print(cnt-1)

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

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

Solution (Python):
S = input()

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

print(cost)

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 = list(input())
c = s[0]
cnt = 0
for idx in range(1, len(s)):
    if c != s[idx]:
        cnt += 1
        c = s[idx]
print(cnt)

Solution (Python):

a = input()

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

Solution (Python):

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

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

Solution (Python):




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

Solution (Python):
s = list(input())
c = s[0]
cnt = 0
for idx in range(1, len(s)):
    if c != s[idx]:
        cnt += 1
        c = s[idx]
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):

import copy
import random
import bisect 
import fractions 
import math
import sys

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

S = str(input())

ans_w = 0
cnt = [0,0] 
left = S[0]
if left == "B":
    cnt[1] += 1
else:
    cnt[0] += 1
for i in range(1,len(S)):
    if left == S[i]:
        pass
    else:
        left = S[i]
        if left == "B":
            cnt[1] += 1
        else:
            cnt[0] += 1

if cnt[0] == cnt[1]:
    ans = (cnt[0] - 1) * 2 + 1

else:
    ans = min(cnt)*2
print(ans)

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

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

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

def main():
  s=S()
  a=s[0]

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

  return c

print(main())

Solution (Python):
S = input()
count = 0
temp = S[-1]
for s in S[-2::-1]:
    if s != temp:
        count += 1
    temp = s
print(0 if count == 0 else count)

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

Solution (Python):




s = input()


ws = s[0]
scnt = 0

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


print(scnt)

Solution (Python):

s = input()
print(s.count("BW") + s.count("WB"))

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

Solution (Python):
s = 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()
cnt = 0
for i in range(len(S) - 1):
	if S[i] != S[i+1]:
		cnt += 1
print(cnt)

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

S_W = [s for s in S.split('W') if s ]
S_B = [s for s in S.split('B') if s ]

W = len(S_W)
B = len(S_B)

print(W + B - 1)

Solution (Python):
from itertools import groupby

s = input()

cnt = 0
for i in groupby(s):
  cnt += 1

print(cnt - 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()
print(S.count('BW') + S.count('WB'))

Solution (Python):
S=input()
N=len(S)
if S=="B"*N or S=="W"*N:
    print(0)
    quit()
tmp=S[0]
ans=0
for i in S:
    if tmp!=i:
        ans+=1
        tmp=i
print(ans)

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

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


solve()

Solution (Python):
S = input()
S_list = list(S)

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

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

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

print(b)

Solution (Python):
S = input()
print( sum([ 1 for x, y in zip(S[:-1], S[1:]) if x != y]) )

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

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

Solution (Python):

"""
C - 一次元リバーシ / 1D Reversi
https://atcoder.jp/contests/abc047/tasks/arc063_a

"""
import sys


def solve(S):
    prev = S[0]
    ans = 0
    for ch in S:
        if ch != prev:
            ans += 1
        prev = ch
    return ans


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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

S = list(input().strip())

c = [0] * 4
t = "B"
for i in range(len(S)):
    if S[i] != t:
        t = S[i]
        c[0] += 1
        
t = "B"
for i in reversed(range(len(S))):
    if S[i] != t:
        t = S[i]
        c[1] += 1

t = "W"
for i in range(len(S)):
    if S[i] != t:
        t = S[i]
        c[2] += 1
        
t = "W"
for i in reversed(range(len(S))):
    if S[i] != t:
        t = S[i]
        c[3] += 1
            
print(min(c))

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

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

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

Solution (Python):
from sys import stdin
S = list(stdin.readline().rstrip())
l = len(S)
ans = 0
for i in range(1,l):
    if S[i] != S[i-1]:
        ans+=1
print(ans)

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

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

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

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 re
s=input()
f=[g for g in re.finditer(s[0]+'{1,}', s)]
k='B' if s[0]=='W'else 'W'
s=[g for g in re.finditer(k+'{1,}', s)]
print(len(f)+len(s)-1)

Solution (Python):
S = input()

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

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

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

Solution (Python):
board1d = [c for c in input()]

ph = board1d.pop()
count = 0
while board1d:
    ph_post = board1d.pop()
    if ph_post != ph:
        count += 1
    ph = ph_post
print(count)

Solution (Python):
s = input()

ss = []

pre = s[0]
cnt = 0
for c in s:
    if c==pre:
        cnt+=1
    else:
        ss.append(cnt)
        cnt=1
        pre = c
ss.append(cnt) 
print(len(ss)-1)

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

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

Solution (Python):
S = input()
nums = []
c = 0
n = S[0]
for s in S:
    if s == n:
        c += 1
    else:
        nums.append(c)
        c = 1
        n = s
nums.append(c)
print(len(nums)-1)

Solution (Python):
S = input()
cnt = 0
last = ''
for i in S:
    if(last != i):
        cnt += 1
    last = i
print(cnt-1)

Solution (Python):
S = input()
num = 0
now = S[0]
for s in S:
    if s == now:
        continue
    if now == "B":
        now = "W"
    else:
        now = "B"
    num += 1
print(num)

Solution (Python):


def solve(S):
    count = 0
    mark = S[0]
    for i in range(1, len(S)):
        if(S[i] == mark):
            continue
        else:
            mark = S[i]
            count += 1
    print(count)
    
if __name__ == '__main__':
    S = list(input())
    
    solve(S)

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

Solution (Python):
s = input()
while ('WW' in s) or ('BB' in s):
    s = s.replace('WW', 'W').replace('BB', 'B')
L = len(s)
num = L-s.count(s[0])
print(2*num-(L+1)%2 if L != 1 else 0)

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

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):


def read_input():
    s = input().strip()
    return s

def submit():
    s = read_input()

    count_marble = 0
    for bigram in zip(s, s[1:]):
        if bigram[0] != bigram[1]:
            count_marble += 1

    print(count_marble)


if __name__ == '__main__':
    submit()

Solution (Python):
S = input()

ans = 0
pre = S[0]
for i in S[1:]:
    if i != pre:
        ans += 1
    pre = i

print(ans)

Solution (Python):
S = list(input())
cum_s = []
count_b, count_w = 0, 0
for s in S:
  if s == 'B':
    count_b += 1
    if count_w > 0:
      cum_s.append(count_w)
      count_w = 0
  else:
    count_w += 1
    if count_b > 0:
      cum_s.append(count_b)
      count_b = 0
cum_s.append(max(count_b, count_w))
print(len(cum_s)-1)

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):
n=input()
ans=1
k=(n[0]=="W")
for a in n:
  if k:
    if a=="W":
      continue
    else:
      ans+=1
      k=0
  else:
    if a=="B":
      continue
    else:
      ans+=1
      k=1
print(ans-1)

Solution (Python):
S=input()

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

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    S = str(input().strip())

    s0 = S[0]
    cnt = 0
    for s in S:
        if s != s0:
            cnt += 1
            s0 = s

    return cnt


if __name__ == '__main__':
    print(main())

Solution (Python):
s = input().rstrip()
prev = s[0]
count = 0
for c in s[1:]:
    if c != prev:
        prev = c
        count += 1
    else:
        pass
print(count)

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

Solution (Python):
S = input()


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

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


ans = sum([1 for i in range(N-1) if S[i]!=S[i+1]])
print(ans)

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()
ans = 0
for i in range(len(s)-1):
  if s[i] != s[i + 1]:
    ans += 1
print(ans)

Solution (Python):
S = input()
counter = 1
moji = S[0]
for char in S:
    if char != moji:
        counter +=  1
        moji = char
        
print(counter - 1)

Solution (Python):
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

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

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

Solution (Python):


s = input()

result1 = s.count("BW")
result2 = s.count("WB")

print(result1 + result2)

Solution (Python):
S = input()

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

Solution (Python):
s = list(input())
c = []
temp = "A"
for s_ in s:
    if temp != s_:
        c.append(s_)
        temp = s_
print(len(c)-1)

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

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

else:
    x = s[0]
    cnt = 0

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

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

Solution (Python):
s=input()
if s[0]=="W":
    j="B"
else:
    j="W"
ans=-1   
for i in s:
    if i!=j:
        ans+=1
        j=i

print(ans)

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

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

Solution (Python):

S=str(input())
Slist=list(S)
Slen=len(Slist)
count=0
mae=""
for i in range(Slen):
    if i == 0:
        mae=Slist[0]
    else:
        if Slist[i] == mae:
            pass
        else:
            mae=Slist[i]
            count+=1
print(count)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()

now = ""
count = 0

for stone in S:
	if stone != now:
		count += 1
	now = stone
print(count-1)

Solution (Python):
def _1d_reversi(S: str) -> int:
    n = len(S)
    return sum(S[i] != S[i-1] for i in range(1, n))


if __name__ == "__main__":
    S = input()
    ans = _1d_reversi(S)
    print(ans)

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

Solution (Python):
s = input()
now = s[0]
i = 0
t = s[0]
while i < len(s):
    if s[i] != now:
        t += s[i]
        now = s[i]
    i += 1
print(len(t) - 1)

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

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):
from functools import reduce

def main():
    
    

    
    
    
    
    
    
    
    

    
    
    
    
    S = list(input().rstrip())
    tmp_color = S[0]
    ans=0 
    for i in range(len(S)):
        if(tmp_color != S[i]):
            tmp_color = S[i]
            ans += 1
    print(ans)
    
if __name__ == '__main__':
    main()

Solution (Python):


n = input()

count = 0
for i in range(len(n)):
    if(i+1 < len(n)):
        if(n[i] != n[i+1]):
            count += 1
print(count)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    s = S()
    c = s.count("0")
    print(2*min(c,len(s)-c))
    return


def B():
    n = I()
    h = LI()
    ans = 0
    m = min(h)
    while m:
        ans += m
        k = max(h)
        for i in range(n):
            if h[i] >= m:
                h[i] -= m
                if h[i]:k = min(k,h[i])
            else:break
        m = k
    print(ans)
    return


def C():
    n,k = LI()
    x = LI()
    ans = float("inf")
    j = bisect.bisect_left(x,0)
    if n == 1:
        print(abs(x[0]))
        quit()
    if j < n:
        if x[j] == 0:
            k -= 1
            x.pop(j)
            n -= 1
    for i in range(n):
        if i < j:
            if abs(i-j) > k:continue
            elif abs(i-j) == k:ans = min(ans,abs(x[i]))
            elif k+i-1 < n:
                ans = min(ans,abs(x[i])+x[k+i-1]-x[i])
        else:
            if abs(i-j)+1 > k:continue
            elif abs(i-j)+1 == k:ans = min(ans,x[i])
            elif i-k+1 >= 0:
                ans = min(ans,abs(x[i])+x[i]-x[i-k+1])

    print(ans)
    return


def D():
    n = I()
    a = LI()
    ans = 0
    p = [1<<i for i in range(100)]
    for i in range(n):
        l = 0
        r = 100
        while r-l > 1:
            m = (l+r)//2
            if a[i]%p[m] == 0:
                l = m
            else:
                r = m
        ans += l
    print(ans)
    return


def E():
    s = LI()
    s.sort()
    ans = s[2]-s[1]
    s[0] += s[2]-s[1]
    s[1] = s[2]
    if s[0]%2 != s[1]%2:
        ans += (s[1]+1-s[0])//2+1
    else:
        ans += (s[1]-s[0])//2
    print(ans)
    return


def F():
    n = I()
    s = SR(n)
    for i in range(n):
        d = defaultdict(int)
        for j in range(len(s[i])):
            d[s[i][j]] += 1
            s[i][j] += str(d[s[i][j]])
    ans = set(s[0])
    for i in range(1,n):
        ans = ans&set(s[i])
    ans = list(ans)
    ans.sort()
    for i in ans:
        print(i[0],end = "")
    print()
    return


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


def H():
    return


def I_():
    return


def J():
    return


if __name__ == "__main__":
    G()

Solution (Python):


















import math
import copy
from collections import defaultdict, Counter

from itertools import product

from itertools import permutations

from itertools import combinations
from bisect import bisect_left, bisect_right


def s_inpl(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
INF = float("inf")

S = input()

a = S.count("BW")
b = S.count("WB")

print(a+b)

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
for i in range(len(S)-1):
    if S[i] != S[i+1]:
        ans += 1
print(ans)

Solution (Python):
from collections import deque

S = input()


stack = []
stack.append(S[0])
count = 0
for c in S:
    if stack[-1] != c:
        count += 1
        stack.append(c)
ans = 10 ** 18
ans = min(ans, count)

count = 0
stack = []
stack.append(S[-1])
for c in S[::-1]:
    if stack[-1] != c:
        count += 1
        stack.append(c)

ans = min(ans, count)

print(ans)

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

print(min(cnt_1,cnt_2))

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()
if s.count('B') == 0 or s.count('W') == 0:
    print(0)
    exit()

import re
if s[0] == 'B':
    s = re.sub(r'B+', 'B', s)
    s = re.sub(r'W+', 'W', s)
    ans = s.count('BW')*2-1
    print(ans if s[-1] != 'B' else ans+1)
else:
    s = re.sub(r'B+', 'B', s)
    s = re.sub(r'W+', 'W', s)
    ans = s.count('WB')*2-1
    print(ans if s[-1] != 'W' else ans+1)

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

Solution (Python):
S = list(input())
Ans = []
count = 0
tmp = S[0]
for i in range(1,len(S)):
    if S[i] != tmp:
        Ans.append(1)
    tmp = S[i]
print(len(Ans))

Solution (Python):
from itertools import groupby

S=input()
answer = sum([1 for _ in groupby(S)]) -1

print(answer)

Solution (Python):
import numpy as np

S=input()
S=np.array([1 if s=='B' else 0 for s in S])

print(np.abs(np.diff(S)).sum())

Solution (Python):
S=input()

answer=0
prev=S[0]
for s in S:
  if s!=prev:
    answer+=1
  prev=s

print(answer)

Solution (Python):
from itertools import groupby

S=input()
answer = -1
for _ in groupby(S):
  answer+=1
  
print(answer)

Solution (Python):
S = input()
new_S = []
now = ''
for x in S:
    if x == now:
        pass
    else:
        new_S.append(x)
    now = x
print(len(new_S)-1)

Solution (Python):
s = input()
ans = 0
for a,b in zip(s[:-1],s[1:]):
  ans += a!=b
print(ans)

Solution (Python):
s = input()

cnt = 0
now = s[0]

for x in s:
    if x != now:
        now = x
        cnt += 1

print(cnt)

Solution (Python):
def main():
    S = input()
    prev = ""
    ans = 0
    for c in S:
        if c != prev:
            ans += 1
        prev = c
    print(ans-1)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
S = input()
keepcount = "P"
count = 0
for i in S:
    if keepcount == "P":
        keepcount = i
    elif keepcount != i:
        keepcount = i
        count += 1

print(count)

Solution (Python):
S = input()

pre = S[0]
res = 0

for i in range(1,len(S)):
    if pre != S[i]:
        res += 1
    pre = S[i]
    
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):
S = input()
cnt = 0
for i in range(len(S)-1):
    if S[i] != S[i+1]:
        cnt += 1
print(cnt)

Solution (Python):
S = [str(_) for _ in input()]
tmp = S[0]
cnt = 0

for i in S:
    if i != tmp:
        cnt += 1
    tmp = i

print(cnt)

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 statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
from operator import itemgetter

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())

rem = pow(10,9)+7




a = input()                                  







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

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

Solution (Python):
s = input()

now = ""
counter = 0
for w in s:
    if now != w:
        counter += 1
    now = w

print(counter - 1)

Solution (Python):
s = list(input())
t = []
for i in range(len(s)):
    if i == len(s)-1:
        t.append(s[i])
    elif s[i] == s[i+1]:
        continue
    else:
        t.append(s[i])

print(len(t)-1)

Solution (Python):

S=input()
n=S[0]
ans=0
for s in S:
    if n!=s:
        n=s
        ans+=1
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):
X = list(input())

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

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

count = 0

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

print(count)

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

S = input()
print(c_1d_reversi(S))

Solution (Python):
s=list(input())
a=s[0]
s.remove(a)
c=0
for i in s:
  if a!=i:
    c+=1
  a=i
print(c)

Solution (Python):
S = input()

l = 0

for c1, c2 in zip(S, S[1:]):
    if c1 == c2:
        l += 1

result = len(S) - l - 1

print(result)

Solution (Python):
print(sum(map(input().count,["WB","BW"])))

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

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()+"E"

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

Solution (Python):
s=input()
flag=2
counter=0
for i in s:
    now_flag=flag
    if i=="B":
        flag=0
    else:
        flag=1
    if now_flag!=flag:
        counter+=1
print(counter-1)

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

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

print(ans)

Solution (Python):
S = input()

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

Solution (Python):
[print(len(list(i.groupby(input())))-1)for i in[__import__('itertools')]]

Solution (Python):
[print(len(list(i.groupby(input())))-1) for i in [__import__('itertools')]]

Solution (Python):
from sys import stdin, stderr, setrecursionlimit, exit
setrecursionlimit(2147483647)
def debug(*args, **kwargs):
    print(*args, file=stderr, **kwargs)

ans = 0
s = input()

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

print(ans)

Solution (Python):
import sys



S = str(input())


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

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

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

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

Solution (Python):
s = input()
t = []
c = -1
pre = "_"
for i in range(len(s)):
    if pre != s[i]:
        pre = s[i]
        c += 1
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):
ret=0
s=input()
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    ret+=1
print(ret)

Solution (Python):
N = input()

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

Solution (Python):
S = input()
tmp = S[0]
cnt = 0
for s in S:
  if(s != tmp):
    cnt += 1
    tmp = s
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
x=s[0]
for t in s:
  if x != t:
    ans+=1
    x=t
print(ans)

Solution (Python):
board = [c for c in input()]


ans = 0
color = board[0]

for stone in board:
    if stone != color:
        ans += 1
        color = stone

print(ans)

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

Solution (Python):
def solve():
    s = input()

    import collections
    deque = collections.deque()

    deque.append(s[0])
    for x in s[1:]:
        if deque[-1] != x:
            deque.append(x)

    return (len(deque)-1)


def main():
    print(solve())


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
s = input()
n = len(s)
ans = 0

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

print(ans)

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

Solution (Python):
S = input()

tmp = 0
Sd = []
while tmp < len(S):
    c = S[tmp]
    l = 0
    while c == S[tmp+l]:
        l += 1
        if tmp+l == len(S): break
    Sd.append((c,l))
    tmp += l

print(len(Sd)-1)

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

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

Solution (Python):
s=input()
seiri=[]
for i in range(len(s)):
    if i==0:seiri.append(s[0])
    elif s[i]!=mae:seiri.append(s[i])
    mae=s[i]
print(len(seiri)-1)

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

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

Solution (Python):
S = input()

cur = S[0]
ans = 0
for x in S[1:]:
    if x == cur:
        continue
    cur = x
    ans += 1
print(ans)

Solution (Python):
s = input().strip()

prev = None
ans1, ans2 = 0, 0
for _s in s:
  if prev is None:
    prev = _s
  elif prev != _s:
    ans1 += 1
    prev = _s
prev = None
for _s in s[::-1]:
  if prev is None:
    prev = _s
  elif prev != _s:
    ans2 += 1
    prev = _s
print(min(ans1, ans2))

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