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

Solution (Python):
a = input()

p = a.count("WB")
q = a.count("BW")

print(p + q)

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)


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

print(cnt)

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

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]







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

input = sys.stdin.readline


def main():
    S = input().rstrip()
    N = len(S)

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
line = list(input())
temp = line[0]
cnt = 0
for c in line[1:]:
	if temp != c:
		cnt += 1
		temp = c

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

s = input()

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

print(ans)

Solution (Python):
from itertools import groupby

print(len([k for k,v in groupby(input())])-1)

Solution (Python):
from collections import deque

s = deque(input())
cnt = 0
p = s.pop()
for _ in range(len(s)):
    n = s.pop()
    if n != p:
        cnt += 1
    p = n
print(cnt)

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

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

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

Solution (Python):
S = input()
prev = S[0]
cnt = 0
for c in S[1:]:
    if c == prev:
        continue
    prev = c
    cnt += 1
print(cnt)

Solution (Python):
import sys
def v():
    S=sys.stdin.readline().strip()
    c,res=S[0],0
    for s in S:
        if c!=s:c,res=s,res+1
    print(res)
if __name__=='__main__':v()

Solution (Python):
from itertools import groupby

s =list(input())
a = []

for key, value in groupby(s):
    a.append(key)


print(len(a)-1)

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

s = input()
print(answer(s))

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


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
if S.count('B') == 0 or S.count('W') == 0:
    print(0)
    exit()
for _ in range(20):
    S = S.replace('BB','B').replace('WW','W')
print(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()



from itertools import groupby

groups = []
uniquekeys = []
for k, g in groupby(s):
    groups.append(list(g))
    uniquekeys.append(k)




print(len(uniquekeys) - 1)

Solution (Python):
def solve():
    S = input()
    
    d = {'B': 0, 'W': 0}
    ps = S[0]
    d[ps] += 1
    for si in S:
        if si != ps:
            d[si] += 1
        ps = si   
    return sum(d.values())-1

print(solve())

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

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

Solution (Python):
S = input()

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

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

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

print(ans)

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

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

ans = 0
tmp = s[0]
state = False
for i in range(1,len(s)):
    if tmp == "B" and s[i] == "W":
        state = True
    elif tmp == "B" and s[i] == "B":
        if state:
            ans += 2
            state = False
            tmp = "B"
    if tmp == "W" and s[i] == "B":
        state = True
    elif tmp == "W" and s[i] == "W":
        if state:
            ans += 2
            state = False
            tmp = "W"

if state:
    ans += 1
print(ans)

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):
def myAnswer(S:str) -> int:
   ans = 0
   pre = S[0]
   for s in S[1:]:
      if (pre != s):
         pre = s
         ans += 1
   return ans

def modelAnswer():
   return
def main():
   S = input()

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

Solution (Python):
s = input()

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

print(len(ans))

Solution (Python):
S = input()
result = -1
piyo = ""
for s in S:
    if piyo != s:
        piyo = s
        result += 1
print(result)

Solution (Python):
S = input()

prev = S[0]
switch_count = 0
for bw in S[1:]:
    if bw != prev:
        switch_count += 1
    prev = bw

print(switch_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 = input()
now = s[0]
ans = 0

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

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

Solution (Python):
S = input()

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

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

print(len(s)-1)

Solution (Python):
s = input()
num = len(s)
'''
WBWBWBWBWB
9ko
'''
temp = s[0]
ans = 0
for i in range(1, num):
    if (temp == s[i]):
        pass
    else:
        ans += 1
        temp = s[i]

print(ans)

Solution (Python):
def main():
    from itertools import tee

    S = input()
    it1, it2 = tee(iter(S), 2)
    next(it2)

    ans = 0
    for c1, c2 in zip(it1, it2):
        if c1 != c2: ans += 1
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
S = input()

color = S[0]

cnt = 0

for c in S:
    if c != color:
        cnt += 1
        color = c

print(cnt)

Solution (Python):
s = input()
wb = s[0]
c = 0
for i in range(1, len(s)):
    if s[i] == wb:
        continue
    else:
        c += 1
        wb = s[i]

print(c)

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

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x=0, y=0):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

def Block(s):
  num = 1
  v1 = []
  v2 = []
  for i in range(len(s)):
    c = s[i]
    if i == 0:
      v1.append(c)
    elif c == s[i-1]:
      num += 1
    else:
      v2.append(num)
      v1.append(c)
      num = 1

    if i == len(s)-1:
      v2.append(num)
  return v1, v2

S = input().rstrip()
chs, num = Block(S)

print(len(chs)-1)

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

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

cnt = 0
check = ""

for i in range(len(s)):
    if check == "":
        check = s[i]
        continue

    if check == s[i]:
        continue
    else:
        check = s[i]
        cnt += 1


print(cnt)

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

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

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

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    turn = 0
    current = S[0]
    for i in range(1, len(S)):
        if S[i] != current:
            turn += 1
            current = S[i]
    print(turn)

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
S = input().strip()
cur = S[0]
cnt = 0
for i in range(1,len(S)):
    if S[i]==cur:continue
    else:
        cnt += 1
        cur = S[i]
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 = str(input())
n = len(s)
cur = s[0]
cnt = 0
L = []
for i in range(n):
    if s[i] != cur:
        L.append(cnt)
        cur = s[i]
        cnt = 1
    else:
        cnt += 1
else:
    L.append(cnt)

print(len(L)-1)

Solution (Python):
s = input()
S = []
b = ""
for i in s:
  if b == "":
    S.append(i)
    b = i
  elif b == i: continue
  else:
    S.append(i)
    b = i
print(len(S)-1)

Solution (Python):
S = input()

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

print(cnt)

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

S = input()[:-1]
ans = 0

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

print(ans)

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

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

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

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

print(ans)

Solution (Python):
import sys
s = input()

if all([x == s[0] for x in s]):
    print(0)
    sys.exit()

bw = s.count("BW")
wb = s.count("WB")

print(bw + wb)

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

s_ = S[0]

ans = 0
for s in S[1:]:
    if s != s_:
        ans += 1
    s_ = s

print(ans)

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

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




S = S()

prev = 0
count = 0
for s in S:
  if s != prev:
    count+=1
  prev = s
P(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):
S=list(input())

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

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

main()

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

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

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

Solution (Python):
s=input()

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

Solution (Python):
import sys
from collections import Counter
from collections import deque
import math
import bisect
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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

print(cnt)

Solution (Python):
s = list(input())
compress = [s[0]]

ans = 0
for c in s:
    if c == compress[-1]:
        continue
    ans += 1
    compress.append(c)

print(ans)

Solution (Python):
S=input()

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

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

Solution (Python):
S = input().strip()
cnt = 0
cur = S[0]
cnt += 1
for i in range(1,len(S)):
    if S[i]==cur:continue
    else:
        cnt += 1
        cur = S[i]
print(cnt-1)

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

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

def main():
    S = readline().strip()
    N = len(S)

    seq = [1]
    for i in range(N-1):
        if S[i+1] == S[i]:
            seq[-1] += 1
        else:
            seq.append(1)
    
    ans = len(seq) - 1
    print(ans)



if __name__ == "__main__":
    main()

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

Solution (Python):
def solve():
    S = input()
    ans = S.count('BW')+S.count('WB')
    return ans
print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    n = len(s)

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


if __name__ == '__main__':
    resolve()

Solution (Python):
import sys

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

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


if __name__ == '__main__':
    main()

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

dp = [0]*n
dp[0]=1
for i in range(1,n):
    if s[i-1]==s[i]:
        continue
    dp[i]=1
print(sum(dp)-1)

Solution (Python):
s=input()
n=len(s)
ans=s.count("WB")
anss=s.count("BW")
print(ans+anss)

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

Solution (Python):
s=input()
now = s[0]
res = 0
for char in s:
    if now != char:
        res += 1
    now = char
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()
count = 0
for i in range(len(s)):
  if(i==0):
    now = s[i]
  else:
    if(s[i] != now):
      count += 1
  now = s[i]
print(count)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = readline().decode('utf-8').strip()
    change = 0
    L = len(S)
    for i in range(1,L):
        if S[i-1]!=S[i]:
            change += 1
    print(change)

if __name__ == '__main__':
    main()

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div

S = rs()
f = ''
ans = -1
for i in S:
    if f != i:
        ans += 1
    f = i
print(ans)

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

Solution (Python):
S = list(input())
runlength = []
temp = S[0]
if len(set(S)) == 1:
    print(0)
    exit() 
for i in range(1,len(S)):
    if temp != S[i]:
        runlength.append(temp)
        temp = S[i]
runlength.append(temp)
print(len(runlength)-1)

Solution (Python):


import itertools

s = itertools.groupby(list(input()))

ans = 0
for _ in s:
    ans += 1

print(ans - 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():
    S  = input()
    A = S[0]

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

    print(len(A)-1)



if __name__ == '__main__':
    main()

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=input()
    tmp=0
    for i in range(len(S)-1):
        tmp+=(S[i+1]!=S[i])
    print(tmp)

if __name__ == '__main__':
    main()

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

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

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

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

before_char = S[0]
ans = 0

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

print(ans)

Solution (Python):

import re
import math
from collections import defaultdict
from collections import deque
import collections
from fractions import Fraction
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache

readline=sys.stdin.readline
sys.setrecursionlimit(2000000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def pm(x):
    return x//abs(x)
def inputintlist():
    return list(map(int,input().split()))


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

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

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

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    board = input()
    n = len(board)
    cnt = 0
    for i in range(n-1):
        if board[i] != board[i+1]:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

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

Solution (Python):
a=input()
ans=0
for i in range(0,len(a)-1):
    if a[i]!=a[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 re
S = input()
S = re.sub("W+", "W", S)
S = re.sub("B+", "B", S)
print(len(S) - 1)

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

if count==0 : print(0)
else : print(count)

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

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)