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 collections import deque

if __name__ == "__main__":
    s = deque(input())
    
    sequenceCount = 0
    stone = s[0]
    for letter in s:
        if letter != stone:
            sequenceCount += 1
            stone = letter
    print(sequenceCount)

Solution (Python):
s = input()

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

print(c)

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

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

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

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 = list(input())

b = []
w = []
num = 1

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

if S[0] == S[1]:
    Flag = True
else:
    Flag = False

for i in range(1, len(S)):
    if S[i-1] == S[i]:
        Flag = True
        num += 1
    else:
        Flag = False
        if S[i-1] == 'B':
            b.append(num)
        elif S[i-1] == 'W':
            w.append(num)
        num = 1

if S[-1] == 'B':
    b.append(num)
else:
    w.append(num)

if num == len(S):
    ans = 0
else:
    n_b = len(b)
    n_w = len(w)
    n = min(n_b, n_w)

    if (n_b + n_w) % 2 == 0:
        ans = 2 * n - 1
    else:
        ans = 2 * n

print(ans)

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

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

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

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

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

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

Solution (Python):
S = input()

s = S[0]
j = 0
for i in range(1, len(S)):
    if s[j] == S[i]:
        continue
    s += S[i]
    j += 1

print(len(s) - 1)

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

Solution (Python):
S = input()
ans = 0
bw = S[0]

for i in S:
    if bw != i:
        ans += 1
        bw = i
print(ans)

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

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):
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().rstrip()
prev = s[0]
res = 0
for c in s[1:]:
    if c != prev:
        res += 1
        prev = c
print(res)

Solution (Python):
s = input()
ans = 0
bw = s[0]
for i in s:
    if bw == "B" and i == "W":
        ans += 1
        bw = "W"
    elif bw == "W" and i == "B":
        ans += 1
        bw = "B"
print(ans)

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

Solution (Python):
s = list(input())
count_left = 0
last = s[0]
for one_color in s:
  if last != one_color:
    count_left += 1
    last = one_color

count_right = 0
last = s[-1]
for one_color in s[::-1]:
  if last != one_color:
    count_right += 1
    last = one_color

print(min(count_left, count_right))

Solution (Python):
s = input()
w = ""
cnt1 = 0
for x in s[1:]:
	if x != w:
		cnt1 += 1
		w = x

cnt2 = 0
for x in s[-2::-1]:
	if x != w:
		cnt2 += 1
		w = x

print(min(cnt1, cnt2))

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

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

Solution (Python):
from sys import stdin
S = (stdin.readline().rstrip())
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
now = s[0]
for si in s[1:]:
    if now == si:
        continue
    ans += 1
    now = si
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 = list(input())
s = 0
for i in range(len(S)-1):
    if S[i] != S[i+1]:
        s += 1
print(s)

Solution (Python):


s = input()

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

Solution (Python):


from itertools import groupby

s = input()

ans = len(list(groupby(s))) - 1
print(ans)

Solution (Python):


s = input()

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

print(cnt)

Solution (Python):


def main():
    S = input()
    count = 0
    for i in range(len(S) - 1):
        if S[i] == S[i+1]:
            pass
        else:
            count += 1
    print(count)
if __name__ == '__main__':
    main()

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):
s=input()
while s!=s.replace('BB','B').replace('WW','W'):
  s=s.replace('BB','B').replace('WW','W')
print(len(s)-1)

Solution (Python):
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 = 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)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from itertools import groupby
    print(len(list(groupby(input())))-1)
resolve()

Solution (Python):
s=str(input())
n=len(s)
c=0
count=0
for i in range(n):
    if s[i]!=c:
        count+=1
        c=s[i]
print(count-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):
def main():
  raw = raw_input()
  s = raw[0]
  for x in xrange(1, len(raw)):
      if raw[x] == s[-1]:
          continue
      s += raw[x]
  print(len(s)-1)


main()

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


if __name__ == "__main__":
    resolve()

Solution (Python):
s = input()
l = len(s)
i =0
while s != 'W' * (l) and s != 'B' * (l):
    x = s[0]
    if x == 'B':
        k = s.find('W')
        s = s[k:]
    else:
        k = s.find('B')
        s = s[k:]
    i += 1
    l = len(s)
print(i)

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

Solution (Python):
from itertools import*;print(len([k for k,g in groupby(input())])-1)

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

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

print(c)

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7



S = input().rstrip()
print(S.count('WB') + S.count('BW'))

Solution (Python):
def f():
    global s
    if s[-1] == x:
        return
    s = s[:-1]
    return f()

s = input()
ans = 0
while s and not s =="W"*len(s) and not s == "B"*len(s):
    if   s[-1] == "W":
        x = "B"
        y = "W"
    elif s[-1] == "B":
        x = "W"
        y = "B"
    f()
    ans += 1
print(ans)

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

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

Solution (Python):
S = list(input())
ans, i, temp = 0, 1, S[0]
while i < len(S):
    if S[i] != temp:
        ans += 1
        temp = S[i]
    i += 1

print(ans)

Solution (Python):
s = list(input())
for i in range(len(s)):
    if s[i] == "B":
        s[i] = 1
    elif s[i] == "W":
        s[i] = 0
cnt = 0
for i in range(len(s)-1): 
    if abs(s[i+1] - 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()
a = []
for i in range(len(s)):
  if i<len(s)-1 and s[i] == s[i+1]:
    pass
  else:
    a.append(s[i])
print(len(a)-1)

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

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

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

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

def main():
    s = input().strip()

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



if __name__ == "__main__":
    main()

Solution (Python):
S = list(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()

check=s[0]
ans=0
for i in range(1,len(s)):
    if check==s[i]:
        continue
    else:
        check=s[i]
        ans+=1
print(ans)

Solution (Python):
s=input()
A=[]
p=s[0]
for i in range(1,len(s)):
	if p!=s[i]:
		A.append(p)
		p=s[i]

A.append(s[-1])

print(len(A)-1)

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

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

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

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):
t, ans = "", 0
for s in input():
    if t != s:
        ans += 1
        t = s
else:
    print(ans - 1)

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

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

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

print(ans)

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

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

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

print(count)

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

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

Solution (Python):
import sys
from collections import Counter

stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

mod = 10 ** 9 + 7

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

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

Solution (Python):
from collections import deque
q = deque([])
S = input()
p = ''
for s in S:
  if s != p:
    q.append(s)
    p = s

print(len(q) - 1)

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

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

Solution (Python):
s = input()
section = 1

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

ans = section - 1
print(ans)

Solution (Python):



S = input().split()[0]
before = S[0]
work_list = [S[0]]

for s in S[1:]:
    if s != before:
        work_list.append(s)
        before = s

ans = len(work_list) - 1
print(ans)

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

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

Solution (Python):
s=input()

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

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

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

Solution (Python):
def main():
    S = input()
    if len(S) == 0: return 0

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

if __name__ == '__main__':

    print(main())

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

count=0
for i in range(1,len(s)):
  if s[i-1] is not s[i]:
    count+=1
print(count)

Solution (Python):

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    s = input()
    if len(s) == 0 or s.count('W') == 0 or s.count('B') == 0:
        print(0)
        return

    pre = s[0]

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


if __name__ == '__main__':
    main()

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    S = input()
    ws = S.split("W")
    w_cnt = 0
    bs = S.split("B")
    b_cnt = 0
    
    flg = True
    for i in ws:
        if i != "":
            flg = False
            w_cnt += 1
            
    if flg == True:
        print(0)
        sys.exit()
        
    flg = True
    for i in bs:
        if i != "":
            flg = False
            b_cnt += 1
    
    if flg == True:
        print(0)
        sys.exit()
        
    ans = (b_cnt + w_cnt) - 1
    print(ans)
    
    
if __name__ == "__main__":
	main()

Solution (Python):
import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7




n = input()

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



print(cnt)

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-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 _pf(s): return print(s, flush=True)

S = input()

if len(set(S)) == 0:
    print(0)
    exit()


"""
WWBBBWBBBBW

右から行くと、4
左から行くと、4

どちらからいってもおなじか？

WBWBWBWBWB
右から->9
左から->9
どちらからいってもかわらない？

右左両方から行く場合
WWBBBWBBBBW
WWBBBBWBW

WB, BWの数を数える？

"""
ans = 0

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

print(ans)

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

p = ''
tmp = ''
for s in S:
    if s != tmp:
        p += s
    tmp = s

print(len(p) - 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()
print(s.count("WB") + s.count("BW"))

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

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

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

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

Solution (Python):
s = input()
for i, c in enumerate(s) :
    if i == 0 :
        zipped = c
        cache = c
    elif cache != c :
        zipped += c
        cache = c
print(len(zipped)-1)

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

Solution (Python):
W = 0
B = 1
S = [W if c == 'W' else B for c in input().strip()]
N = len(S)
c = S[0]
answer = 0
for i in range(1,N):
    if c != S[i]:
        answer += 1
        c = S[i]
print(answer)

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

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

def runLength(s):
    a = []
    for c in s:
        if len(a)==0 or a[-1][0]!=c:
            a.append([c,1])
        else:
            a[-1][1] += 1
    return a
s = input().strip()
a = runLength(s)
print(len(a)-1)

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

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

import collections
import itertools
import sys
import time

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

s = input()

res = 0

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

print(res)

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

Solution (Python):
s = input()

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

left = 0
right = 0

count = 0
while True:
  if s[right+1] != s[left]:
    count += 1
    right += 1
    left = right
    if right == len(s) - 1:
      break
  else:
    right += 1
    if right == len(s) - 1:
      break

print(count)

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):
board = input()

while "BB" in board:
    board = board.replace("BB", "B")
while "WW" in board:
    board = board.replace("WW", "W")

print(len(board)-1)

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

Solution (Python):


s=input()
BW='B' if s[0]=='B' else 'W'
cnt=0

for i in range(len(s)):
    if s[i]==BW:continue
    BW=s[i]
    cnt+=1
print(cnt)

Solution (Python):

import sys, math, fractions, itertools


def solve(S: str):
    tmp = S[0]
    counter = 0
    for s in S:
        if tmp != s:
            counter += 1
        tmp = s
    print(counter)
    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 = list(str(input()))

if len(s) == 1:
  print(0)
  exit()
  
temp = s[0]
c = 0

for i in range(1, len(s)):
  if s[i] != temp:
    c += 1
    temp = s[i]
  else:
    continue

print(c)

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

s = list(input())[:-1]

reverse = 0
current = 'X'
for x in s:
    if current != x:
        reverse+=1
        current = x

reverse-=1

print(reverse)

Solution (Python):

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

print(border)

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

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

for i in range(1, len(S)):
    if S[i] == S[i-1]:
        pass
    else:
        count += 1

print(count)

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

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

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import bisect



def main():
    data = list(input())
    
    
    
    

    white, black = 0, 0

    pre = ''
    for i in range(len(data)):
        if pre == data[i]:
            continue
        pre = data[i]
        if data[i] == 'W':
            white += 1
        else:
            black += 1

    print(black+white - 1)



if __name__ == '__main__':
    main()

Solution (Python):
S = input()

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

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

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

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

print(num)

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(S: str):
    def count(s):
        tmp = s[0]
        cnt = 0
        for c in s:
            if c != tmp:
                cnt += 1
                tmp = c
        return cnt
    
    ret = count(S)
    print(ret)
    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()
old="x"
ans=-1
for c in s:
    if old != c:
        ans+=1
    old=c
    
print(ans)

Solution (Python):
s=input()
c=0
X=s[0]
for x in s:
    if X!=x:c+=1;X=x
print(c)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

S = sys.stdin.readline().rstrip()
cnt = 0
p = None
for c in S:
    cnt += p != c
    p = c
print(cnt - 1)

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

Solution (Python):

"""考え方
・BBBBWWW
右にBを置けば良い

・WWBBWW
右にBを置く
右にWを置く

・WBWBWBWBBBBBBW
右にBWBWBWBWの順に置く
または、
左にBWBWBWBWの順に置く

どうやら、左と右でもかわらない様子
"""
def solve():
    S = input()

    ans = 0
    now = S[0]
    for i, moji in enumerate(list(S)):
        if now == moji:
            continue
        ans += 1
        now = moji
    print(ans)
    

if __name__ == "__main__":
    solve()

Solution (Python):

S = input()


ans = 0
now = ""

for s in S:

    if now != s:

        now = s
        ans += 1

print (ans-1)

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

Solution (Python):
S = input()

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

Solution (Python):
S = input()

color = None
count = 0
for i in list(S):
  if i != color:
    count += 1 

  color = i

print(count-1)

Solution (Python):
def main():
    s = list(input())
    tmp = s[0]
    res= 0

    for i in s[1:]:
        if i != tmp:
            res += 1
            tmp = i
    print(res)

if __name__ == '__main__':
    main()

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 = str(input())
print(s.count("WB")+s.count("BW"))

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):
S=input()

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

print(ans)

Solution (Python):
S = input()

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

Solution (Python):
S = input()
newS = ''
if len(S) == 1:print(0)
else:
    i = pre = 0
    while True:
        if i > len(S) - 1:
            newS = newS + S[pre]
            break
        else:
            if S[pre] != S[i]:
                newS = newS + S[pre]
                pre = i
            else:i += 1
    print(len(newS)-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()
lens=len(s)
i=0
cnt=0
if lens > 1:
  for i in range(lens-1):
    if s[i]!=s[i+1]:
      cnt+=1
    
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):
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()

count = 0
was = S[0]
for c in S:
    if c != was:
        count += 1
    was = c
print(count)

Solution (Python):
S = input()

WBWB = []
phase = 'W'
count = 0
for i in range(len(S)):
    if S[i] == 'W' and phase == 'B':
        WBWB.append(count)
        phase = 'W'
        count = 0
    if S[i] == 'B' and phase == 'W':
        WBWB.append(count)
        phase = 'B'
        count = 0
    count += 1
WBWB.append(count)
temp = []
if WBWB[0] == 0:
    WBWB = WBWB[1:]

if len(WBWB) == 0:
    ans = 0
else:
    ans = len(WBWB) - 1

print(ans)

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()
c=s[0]
cnt=0
for x in s:
	if c!=x:
		c=x
		cnt+=1
print(cnt)

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

Solution (Python):
S = input()

pre_state = S[0]
cnt = 0
for i in range(1,len(S)):
  if not S[i] == pre_state:
    pre_state = S[i]
    cnt += 1

print(cnt)

Solution (Python):
s = input()
if s.find("W") == -1 or s.find("B") == -1:
    print(0)
elif len(s) == 1:
    print(2)
else:
    res = 0
    c = s[0]
    for i in range(len(s) - 1):
        if c != s[1+i]:
            c = s[1+i]
            res += 1
    print(res)

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

Solution (Python):
b = input()
d = []
isWhite = False
cnt = 0
for i in range(len(b)-1):
  if b[i] != b[i+1]:
    d.append(cnt)
  else:
    cnt+=1

print(len(d))

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

flg = s[0]
cnt = 1

for i in s:
    if flg == i:
        pass
    else:
        flg = i
        cnt += 1

print(cnt-1)

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