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 = str(input())
count = 0
now = S[0]
for i in S[1:]:
    if now!=i:
        count+=1
        now = i
print(count)

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

print(count)

Solution (Python):
S = str(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-1] != S[i]:
    ans += 1
print(ans)

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

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

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

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

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

Solution (Python):
S = input()

count = 0
pre_s = None
for s in S:
    if s != pre_s:
        count += 1
        pre_s = s
print(count - 1)

Solution (Python):
S = input()

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

Solution (Python):
S = input()

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

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

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

for s in S:
    if s != before:
        cnt += 1
    before = s
print(cnt)

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

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

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

Solution (Python):
S = input()
import re
SD = re.sub(r"W+", "W", S)
SD = re.sub(r"B+", "B", SD)
print(len(SD)-1)

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

Solution (Python):
word=input()

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

before_color = S[0]
ans = 0

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

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

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

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

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

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

Solution (Python):
line = input()

count = -1
current = "hoge"
for c in line:
    if current != c:
        count += 1
        current = c

print(count)

Solution (Python):
s = input()
st = s[0]
ans = 0

for c in s:
    if c != st:
        ans += 1
        st = c

print(ans)

Solution (Python):
s = input()

count = 0

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

print(count)

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

print(ans-1)

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

Solution (Python):


import sys
input = sys.stdin.readline

S = input()

N = len(S) - 1

numW = S.count('W')
numB = N - numW
if (numW == N) | (numW == 0):
    print(0)
    sys.exit()

res = 0
checked = 0

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

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

import itertools

S2=[k for k, v in itertools.groupby(S)]

print(len(S2)-1)

Solution (Python):
from itertools import groupby

S = groupby(input())
cnt = sum([1 for k, v in S])
print(cnt-1)

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

ans = 0
before = ""

for s in sl:
   if before == s:
      continue
   else:
      ans += 1
      before = s
   
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):

import sys
S = sys.stdin.readline().rstrip()

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

pre = s[0]
ans = 0
for si in s:
  if pre != si:
    ans += 1
    pre = si

print(ans)

Solution (Python):
S = raw_input()

s = S
n = 0
while len(s):
    s = s.lstrip(s[0])
    if len(s):
        n += 1

print n

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

N = len(S)

string = []
string.append(S[0])

for n in range(1, N):
    if S[n - 1] == S[n]:
        continue
    else:
        string.append(S[n])

print(len(string) - 1)

Solution (Python):
s = input()
ans = 0
now = s[0]
for i in range(1, len(s)):
    if now == "B":
        if s[i] == "W":
            ans += 1
            now = "W"
    else:
        if s[i] == "B":
            ans += 1
            now = "B"
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):
a = list(input())
s = -1
d = ''
for i in a:
    if i != d:
        s += 1
    d = i
print(s)

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

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

Solution (Python):
a = list(input())
s = -1
d = ''
for i in a:
    if i != d:
        s += 1
    d = i
print(s)

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

print(count)

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

print(answer)

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

print(ans)

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

Solution (Python):
s = input()

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

print(ans)

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

Solution (Python):
import sys

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

S = input().rstrip()

A = [s for s in S]
B = []

now = -1
cur = 0
for i, a in enumerate(A):
	if now == -1:
		B.append(a)
		now = a
	if now != a:
		B.append(a)
		now = a



print(len(B)-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()


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

Solution (Python):
from itertools import groupby

S = input()

s = [i for i, j in groupby(S)]
print(len(s)-1)

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

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

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

Solution (Python):
s=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]
cnt = 0

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

Solution (Python):
import sys

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

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

if __name__ == '__main__':
    ans = main()
    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):
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    prev = None
    count = 0
    for c in S:
        if prev is not None and prev != c:
            count += 1
        prev = c
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Solution (Python):
import re

s = input()


w = re.findall(r'[W]+', s)

b= re.findall(r'[B]+', s)


if s.count("W") == len(s):
    print(0)
else:
    print(len(w)+len(b)-1)

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

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

border = 0

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

print(border)

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

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

cnt = 0

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

print(cnt)

Solution (Python):
S = input()

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

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

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

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

Solution (Python):











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

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

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

Solution (Python):
def main():
    s=input()
    now=s[0]
    cnt=0
    for i in range(1,len(s)):
        if now!=s[i]:
            cnt+=1
            now=s[i]
    print(cnt)
if __name__=='__main__':
    main()

Solution (Python):
from sys import stdin

s = stdin.readline().rstrip()

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

print(point)

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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
from itertools import groupby
def resolve():
    S=input()
    print(len(tuple(groupby(S)))-1)
resolve()

Solution (Python):
from itertools import groupby

s = input()
g = groupby(s)

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

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

print(cnt)

Solution (Python):
s = input()
count = 0
while True :
    if s == "" :
        break
    elif s[-1] == "B":
        s = s.rstrip("B")
        count += 1
    elif s[-1] == "W" :
        s = s.rstrip("W")
        count += 1
print(count -1)

Solution (Python):
s = input()
count = 0
while True :
    if s == "" :
        break
    elif s[-1] == "B":
        s = s.rstrip("B")
        count += 1
    elif s[-1] == "W" :
        s = s.rstrip("W")
        count += 1
print(count -1)

Solution (Python):
import sys

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

S = ns()
answer = 0
cur = S[0]

for s in S:
    if s != cur:
        answer += 1
        cur = s

print(answer)

Solution (Python):
def main():
    s = input()
    now = s[0]
    ans = 0
    for i in range(1,len(s)):
        if now==s[i]:
            pass
        else:
            now = s[i]
            ans += 1
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    if S[0] == "B":
        K = "WB"
    else:
        K = "BW"
    cnt = S.count(K)

    if S[0] == S[-1]:
        print(2 * cnt)
    else:
        print(1 + 2 * cnt)


main()

Solution (Python):
def main():
    S = input()
    if S[0] == "B":
        K = "WB"
    else:
        K = "BW"

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

    if S[0] == S[-1]:
        print(2 * cnt)
    else:
        print(1 + 2 * cnt)


main()

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

Solution (Python):
s = input()
a = s[0]
for i in range(1,len(s)):
  if s[i]!=s[i-1]: a+= s[i]
if a.count("W") ==0 or a.count("B")==0:
  print(0)
else:
  print(len(a)-1)

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

Solution (Python):

import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Solution (Python):
s=input()
a=[s[0]]
p=s[0]
for x in s:
  if x!=p:
    a.append(x)
  p=x
print(len(a)-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 = str(input())

count = 0

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

print(count)

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

print(counter)

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

Solution (Python):

import sys














def main():
    s = sys.stdin.readline().rstrip()

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

    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
l = input()
def runlength(S):
    ans = []
    for s in S:
        if len(ans) == 0 or ans[-1][0] != s:
            ans.append([s,1])
        else:
            ans[-1][1] += 1
    return ans
print(len(runlength(l))-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()
c = 0
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        c += 1
print(c)

Solution (Python):
from operator import itemgetter


s=list(input())

count=0

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

print(count)

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

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

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

Solution (Python):

S = input()
cur_s = ''
SS=[] 
for i,s in enumerate(S):
    if i==0:
        cur_s = s
        SS.append(s)
        continue
    if i==len(S):
        if cur_s == s:
            continue
        else:
            SS.append(s)
            continue

    if cur_s == s:
        continue
    else:
        SS.append(s)
        cur_s = s

n = len(SS)
m = n//2
if n==1:
    print(0)
    exit()

if n%2==1:
    print(m*2)
else:
    print(((n//2)*2)-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 solve():
    S = input()

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

if __name__ == '__main__':
    solve()

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(S: str):
    c = 0
    b = S[0]
    N = len(S)
    for i in range(1,N):
        if S[i] != S[i-1]:
            c += 1

    print(c)
    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(input())

T=S[0]
c=0

for s in S:
    if(T!=s):
        c+=1
        T=s
print(c)

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

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

Solution (Python):
S = input()

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

Solution (Python):
S = input()
ans = 0
prev = ""
for i, s in enumerate(S):
  if i == 0:
    prev = s
  else:
    if prev != s:
      ans += 1
    prev = s
print(ans)

Solution (Python):
S = input()

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

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

    if s.count("W") == 0 or s.count("W") == len(s):
        return 0

    counter = 0
    i = len(s) - 1
    while 0 < i:
        tail = s[i]
        
        if tail == "W":
            
            
            counter += 1
            
            while 0 < i and not s[i] == "B":
                i -= 1
            
            

            
            if s[i - 1] == "B":
                while 0 < i and s[i - 1] == "B":
                    i -= 1
            

        else:
            
            
            counter += 1
            
            while 0 < i and not s[i] == "W":
                i -= 1
            
            

            
            if s[i - 1] == "W":
                while 0 < i and s[i - 1] == "W":
                    i -= 1
            

    

    return counter


if __name__ == '__main__':
    res = solve()
    print(res)

Solution (Python):

import sys
input = sys.stdin.readline


S = input().rstrip()

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

print(ans)

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 examC():
    St = S()
    N = len(St)
    cur = int(0)
    for i in range(N-1):
        if St[i]!=St[i+1]:
            cur +=1
    print(cur)



import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examC()

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

    print(count)

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    if len(set(S)) == 1:
        print(0)
    else:
        s2 = ''
        prev = ''
        for si in S:
            if si == prev:
                pass
            else:
                s2 += si
            prev = si
        
        print(len(s2) - 1)


if __name__ == "__main__":
    main()

Solution (Python):
S=input()

count=0
for ind,color in enumerate(S):
    if(ind==0):
        c=color
    else:
        if(c==color):
            continue
        else:
            count+=1
            c=color
print(count)

Solution (Python):
r=input()
now=r[0]
count=0
for i in range(1,len(r)):
  if now!=r[i]:
    now=r[i]
    count+=1
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 sys
sys.setrecursionlimit(10 ** 7)


def main():
    s = input()
    compressed = ""
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            compressed += s[i]
    compressed += s[-1]

    print(len(compressed)-1)


if __name__ == '__main__':
    main()

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


main()

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


main()

Solution (Python):
def main():
    S = input()
    ans = -1
    pre = ""
    for s in S:
        if pre != s:
            ans += 1
            pre = s
    print(ans)
    return


main()

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

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

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

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

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

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

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

print(ans)

Solution (Python):





mod=10**9+7
def factorial(x): 
    n=1
    for i in range(x):
        n=(n*(i+1))%mod
    return n

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))
def div(x): 
    div=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            div.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
      div.append(x)
    return div
def div2(x): 
    div2=[]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            div2.append(check)
            x/=check
        check+=1
    if x != 1:
      div2.append(x)
    return div2

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

Solution (Python):

import sys
import itertools

def solve(S: str):
    a = itertools.groupby(S)
    print(len(list((a)))-1)
    return


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

if __name__ == '__main__':
    main()

Solution (Python):
"ABC 047 C - 一次元リバーシ / 1D Reversi "

if __name__ == "__main__":
    S = input()

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

    print(ans)

Solution (Python):
s = list(input())
n = len(s)
ans = 0
x = s[0]
for i in range(n):
        if x==s[i]:
            continue
        else:
            ans+=1
            x = s[i]
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):
S=input()
prev=S[0]
ans=0
for i in range(len(S)):
  if S[i] == prev:
    continue
  else:
    ans+=1
    prev=S[i]
print(ans)

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

Solution (Python):
S = input()

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

print(ans)

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

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

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

Solution (Python):
s=input()
cnt=0
col=s[0]
for i in s:
    if i==col:continue
    else:
        col=i
        cnt +=1
print(cnt)

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

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

Solution (Python):
s=input()
n=len(s)
grps=0 
i=0
c=0 
while i<n: 
    curr=s[i]
    c+=1 
    while i<n and curr==s[i]:
        i+=1 
print(c-1)

Solution (Python):
s=input()
from itertools import groupby
g=groupby(s)
a=[]
for i,j in g:
  a.append(i)
print(len(a)-1)

Solution (Python):


S = input()

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

Solution (Python):
S = list(input())
size = len(S)
b = [] 
cnt = 0 
now = S[0]
for i in range(size):
  if S[i] == now :
    cnt += 1
  else:
    b.append(cnt)
    now = S[i]
    cnt = 0
b.append(cnt)
print("{}".format(len(b)-1))

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

Solution (Python):
S=input()

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

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

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

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

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

tmp = s[0]
cnt = 0

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

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

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