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

Solution (Python):
import sys

S = sys.stdin.readline().strip()
changed = 0
for i in range(len(S) - 1):
    if S[i] != S[i+1]:
        changed += 1

print(changed)

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

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

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

def cino(test=False):
    if not test:
        return int(input())
    else:
        return input()
def cina():
  return list(map(int,input().split()))


s = cino(True)
s+='A'
s = list(s)
cnt = -1
for i in range(len(s)-1):
    if s[i+1]!=s[i]:
        cnt += 1
print(cnt)

Solution (Python):

"""
Created on Thu May 14 18:16:23 2020

@author: shinba
"""

s = input()

start = s[0]
cnt1 = 0

for i in range(1,len(s)):
    if s[i] == start:
        continue
    cnt1 += 1
    start = s[i]

start = s[-1]
cnt2 = 0

for i in range(len(s)-1,-1,-1):
    if s[i] == start:
        continue
    cnt2 += 1
    start = s[i]

print(min(cnt1,cnt2))

Solution (Python):
def main():
    from itertools import groupby
    s = input()
    c = 0
    for k, g in groupby(s):
        c += 1

    print(c - 1)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    S = list(input())

    obj = S[0]
    cnt = 1
    L = []
    for i in range(1, len(S)):
        if S[i] == obj:
            cnt += 1
        else:
            L.append(cnt)
            obj = S[i]
            cnt = 1
    L.append(cnt)

    
    print(len(L) - 1)


if __name__ == '__main__':
    solve()

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal

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

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



def main():
    s = list(sys.stdin.readline())
    del s[len(s) - 1]
    cnt = 0

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

    print(max(0, cnt))


if __name__ == '__main__':
    main()

Solution (Python):
S = input()

print(len([0 for c1, c2 in zip(S[:-1], S[1:]) if c1 != c2]))

Solution (Python):
S = input()

print(len([0 for index, c in enumerate(S[1:], 1) if c != S[index - 1]]))

Solution (Python):
import re
string = input()
ans = 0
for i in range(len(string)-1):
    if string[i] != string[i+1]:
        ans += 1
print(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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
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):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

Solution (Python):
s = input()

ans = 0
tmp = s[0]
for x in s[1:]:
    if x != tmp:
        ans += 1
        tmp = x

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

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

print(ans)

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

Solution (Python):
import collections
import numpy as np
import sys
import copy
from functools import lru_cache
sys.setrecursionlimit(10**8)




num2alpha = lambda c: chr(c+96)
s=list(input())
ans=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        ans+=1
print(ans)

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9+7

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())
if len(list(set(S))) != 1:
    i =0
    count = 0
    while True:
        if S[i] != S[i+1]:
            count += 1
            S[i] = S[i + 1]
        i += 1
        if i == (len(S)-1):
            break
else:
    count = 0
print(count)

Solution (Python):
S = input()

def countcomponents(S):
    count = 1
    current = S[0]
    for i in range(len(S)):
        if S[i] != current:
            count += 1
            current = S[i]
    return count

print(countcomponents(S) - 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 = str(input())
cnt = 1
ans = 0

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

print(ans)

Solution (Python):
from itertools import groupby


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

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

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

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


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

    S = list(iss())
    q = S[0]
    ret = 0
    for s in S:
        if q != s:
            ret += 1
            q = s
    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

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


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

    S = itertools.groupby(list(iss()))
    q = ''
    ret = 0
    for s in S:
        if q == '':
            q = s
        if q != s:
            ret += 1
            q = s
    print(ret)


if __name__ == '__main__':
    main()

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

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

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

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

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()
c1=s[0]
res=0
for c in s:
    if c==c1:
        continue
    else:
        res+=1
        c1=c
print(res)

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):
def main():
    S = input()
    answer = 0

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

    print(answer)

if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()

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

print(ans)

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

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

Solution (Python):
s=input()

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

Solution (Python):
s = input()
prev = None
total = 0
for i in s:
    if prev == None:
        prev = i
    else:
        if (i != prev):
            total += 1
            prev = i
        else:
            pass
print(total)

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

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



if '__main__' == __name__:
    resolve()

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()
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 = -1
old = ""
for c in S:
  if old != c:
    old = c
    ans += 1

print(ans)

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

Solution (Python):

import sys

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

print(ans)

Solution (Python):
S = input()
l = [S[0]]
b = S[0]
for s in S:
    if b == s: continue
    else:
        b=s
        l.append(s)
print(len(l)-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):
from itertools import groupby
s = input()
print(len(list(groupby(s)))-1)

Solution (Python):
import re

s = input()
s = re.sub(r'W+', "W", s)
s = re.sub(r'B+', "B", s)
print(len(s) - 1)

Solution (Python):
s = input()
li_s = list(s)
start = li_s[0]
count=0
for l in li_s:
    if l!=start:
        count+=1
        start = l
print(count)

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

Solution (Python):
l = input()

print(l.count('WB') + l.count('BW'))

Solution (Python):
s=input()
from itertools import groupby as gb
print(len(list(gb(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()

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

Solution (Python):
S = input()

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

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = read().rstrip().decode()
memo = s[0]
cnt = 0
for check in s[1:]:
    if memo != check:
        memo = check
        cnt += 1
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()
t = ""
count = -1

for i in s:
    if i!=t:
        t = i
        count += 1
print(count)

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

Solution (Python):
s = input()

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

Solution (Python):
s = input()
ans = 0
color = s[0]
for i in range(1, len(s)):
    if color != s[i]:
       color = s[i]
       ans += 1
    
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 = str(input())
res = 0

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

print(res)

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

Solution (Python):
S = input()

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

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

def main():
    S = list(readline().rstrip())
    ans = 0
    for i in range(1, len(S)):
        if S[i-1] != S[i]:
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
s = input()
t = s[0]
res = 0
if len(s)==1:
    print(0)
    exit()
for i in s[1:]:
    if t == i:
        pass
    else:
       res = res+1
       t = i

print(res)

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

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

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

l = len(S)
count = 0

if S[0]=='W':
	isblue = 0
else:
	isblue = 1


for i in range (1, l):
	if isblue == 0 and S[i] == 'B':
		isblue = 1
		count+=1
	elif isblue == 1 and S[i] == 'W':
		isblue = 0
		count+=1
	else:
		continue

print(count)

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

Solution (Python):
S = input() + 'x'

c = 'x'
cnt = 0
for s in S:
    cnt += (s != c)
    c = s
print(cnt - 2)

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

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

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

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

Solution (Python):
s = input()
l = list(s[0])
for i in s:
  if i!=l[-1]:
    l.append(i)
print(len(l)-1)

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

Solution (Python):


from itertools import groupby


def main():
    S = input()

    result = 0
    for i in groupby(S):
        result += 1

    print(result - 1)


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

now = ''
counter = 0

for i in range(len(s)):
    if i == 0:
        now = s[i]
        continue
    if s[i] != now:
        now = s[i]
        counter += 1

print(counter)

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

Solution (Python):
import io

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

Solution (Python):
S = input()


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

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

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()
N = len(S)
slist = []
solvelist = []
for i in range(N):
    slist.append(S[i])

solvelist.append(S[0])
for i in range(N-1):
    if slist[i] == slist[i + 1]:
        pass
    else:
        solvelist.append(S[i+1])

ans = len(solvelist) - 1

print(ans)

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


ans = cnt
cnt = 0
now = s[-1]
for i in range(n-2,-1,-1):
    if s[i] != now:
        cnt+=1
        now = s[i]
ans = min(cnt,ans)
print(ans)

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

Solution (Python):
import sys

S = list(input())
ls = len(S)

if ls == 1:
    print(0)
    sys.exit()
elif len(set(S)) == 1:
    print(0)
    sys.exit()

tg = S[0]
n = 0
for i in range(ls):
    if i == 0:
        continue
    else:
        if S[i] != tg:
            n += 1
            tg = S[i]
print(n)

Solution (Python):
S = input()
s = S[0]
cnt = 0

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

Solution (Python):
S = input()
S = [1 if s == 'W' else -1 for s in S]






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

Solution (Python):
from collections import Counter
s = list(input()) 



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

Solution (Python):
def solve(s):
    prev = s[0]
    count = 0
    for i in s[1:]:
        if prev != i:
            count += 1
        prev = i
    return count

if __name__ == "__main__":
    s = input()
    print(solve(s))

Solution (Python):
s = input()

S = []
for i in range(len(s)):
    if i == 0:
        S.append(s[i])
    else:
        if S[-1] != s[i]:
            S.append(s[i])

print(len(S) - 1)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    
    from itertools import combinations, permutations, accumulate, groupby
    
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    

    
    

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(1000000)

S = list(input())
L = len(S)
b = S.count("B")
w = S.count("W")

def f(i, result):
  if S[i] == S[i-1]:
    if i == 1:
      print(result)
      exit()
    else:
      f(i-1, result)
  else:
    if i == 1:
      result += 1
      print(result)
      exit()
    else:
      result += 1
      f(i-1, result)
      
if L == 1:
  result = 0
  print(result)
  exit()
elif b == L or w == L:
  result = 0
  print(result)
  exit()
else:
  f(L-1, 0)

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()

def main():
    prev = '$'
    cnt = -1
    for c in s:
        cnt += c != prev
        prev = c
    print(cnt)

if __name__ ==  '__main__':
    main()

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:
    return a
  return gcd_(a,a % b) 
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


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

def main():
  s = input()
  ans = 0
  slen = len(s)
  COMP = s[slen-1]
  for i in range(slen-2, -1,-1):
    if COMP != s[i]:
      COMP = s[i]
      ans += 1
  print(ans)
if __name__ == '__main__':
  main()

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

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

Solution (Python):
def resolve():
    '''
    code here
    '''
    line = input()

    cnt = 1
    prev = line[0]

    if len(line) == 1:
        res = 0
    else:
        for item in line[1:]:
            if item == prev:
                pass
            else:
                cnt += 1
            prev = item
        res = cnt -1
    print(res)

if __name__ == "__main__":
    resolve()

Solution (Python):
s = input()

prev = None
cnt = 0
for elem in s:
  if prev is None:
    prev = elem
  elif prev == elem:
    pass
  else:
    cnt += 1
    prev = elem
print(cnt)

Solution (Python):
s=input()

s = list(s)

count = 0

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

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

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

print(ans)

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

Solution (Python):
from collections import deque
s = deque(input())
ans = 0
a = s.pop()
while len(s):
    b = s.pop()
    if a != b:
        ans += 1
        a = b
print(ans)

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

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

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

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

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

Solution (Python):
def resolve():

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

resolve()

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

print(ans)

Solution (Python):
S = input()

s0 = ""
ans = 0
for s in S:
    if s0 != s:
        ans += 1
        s0 = s
print(ans - 1)

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

Solution (Python):
s = input()

w_s = s[0]
RC = 0
for idx1 in range(1, len(s)):
    if s[idx1] != w_s:
        RC += 1
        w_s = s[idx1]

print(RC)

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

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

Solution (Python):
s = input()

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

print(ans)

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

Solution (Python):
import sys

S = input()
if len(set(S)) == 1:
    print(0)
    sys.exit()

tmp = ""
for i in range(1, len(S)):
    if S[i - 1] == S[i]:
        continue
    else:
        tmp += S[i - 1]

tmp += S[-1]

print(len(tmp) - 1)

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

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

Solution (Python):
S = input()

prev = "a"
cnt = 0
for s in S:
    if prev != s:
        cnt += 1
    prev = s
print(cnt-1)

Solution (Python):
S = input()

length = len(S)
ans = 0

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

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

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

Solution (Python):
s=input();print(sum(c!=d for c,d in zip(s,s[1:])))

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

Solution (Python):
s = input()

a = s.count('BW')
b = s.count('WB')

print(a + b)

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

Solution (Python):
s = input()

n = len(s)
ans = 0
s0 = s[0]
lastI = 0

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

for i in range(1, n-1):
    
    
    
    
    if s[i] != s0 and s[i+1] == s0:
        ans += 2
        lastI = i+1

if lastI != n-1 and s0 != s[-1]:
    ans += 1

print(ans)

Solution (Python):
s = input()

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

print(res)

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

Solution (Python):
S = input()

s = []
before = S[0]
for i in range(len(S)):
    if S[i] != before:
        s.append(before)
        before = S[i]
    
    if i == len(S)-1:
        s.append(S[i])

print(len(s)-1)

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

S = input().rstrip("\r\n")
g = groupby(S)
print(len(list(g))-1)

Solution (Python):
s=input()
l=[]
for i in s:
    if len(l)==0:
        l.append(i)
    else:
        if l[-1]==i:
            continue
        else:
            l.append(i)
print(len(l)-1)

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

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

Solution (Python):
s =  input()
ans = 0
tmp = ''
for w in s:
  if len(tmp)==0:
    tmp = w
    continue
  if tmp != w:
    ans+=1
    tmp = w

print(ans)