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):
ans = []
S=list(input())
for i in range(len(S)-1):
  if S[i] != S[i+1]:
    ans.append(S[i])
print(ans.count("W")+ans.count("B"))

Solution (Python):

"""
Created on Wed Sep 30 02:12:31 2020

@author: liang
"""

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

print(ans)

Solution (Python):

"""
Created on Wed Sep 30 02:12:31 2020

@author: liang
"""

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

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

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

s_ = s[0]

for c in s:
    if s_[-1]!=c:
        s_ += c
print(len(s_)-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()
    ans = 0
    for i, s in enumerate(S):
        if i == 0:
            t = s
            continue
        if t == s:
            continue
        else:
            ans += 1
            t = s
    print(ans)
        
if __name__ == "__main__":
    main()

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

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

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

print(ans)

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

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

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

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

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

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

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

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

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

print(counter)

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

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

Solution (Python):
def main():
    s = str(input())
    b_count = s.count('B')
    w_count = len(s) - b_count

    if b_count == len(s) or w_count == len(s):
        count = 0
    else:
        count = 0
        index = 0
        alp = s[index]

        while True:
            if b_count == 0 or w_count == 0:
                break
            else:
                if s[index] == 'B':
                    b_count -= 1
                else:
                    w_count -= 1

                if s[index] == alp:
                    index += 1
                else:
                    count += 1
                    alp = s[index]
                    index += 1

        if not (b_count == 0 and w_count == 0):
            count += 1

    print(count)


if __name__ == '__main__':
    main()

Solution (Python):
S = [1 if x=="W" else 0 for x in input()]

groups = []
tmp = 0
zeros = 0
for n in S:
    if n == 1:
        if zeros != 0:
            groups.append(zeros)
            zeros = 0
        tmp += 1
    elif n == 0:
        if tmp != 0:
            groups.append(tmp)
            tmp = 0
        zeros -= 1


if tmp != 0:
    groups.append(tmp)
if zeros != 0:
    groups.append(zeros)
    
print(len(groups)-1)

Solution (Python):
s = input()

n = len(s)

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

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

Solution (Python):
S = input()

ls = ["WB", "BW"]

cnt = 0
if S[0] == "W":
  i = 0
else:
  i = 1

for j in range(len(S)-1):
  if i == 0 and S[j:j+2] == "WB":
    cnt += 1
    i = 1
  if i == 1 and S[j:j+2] == "BW":
    cnt += 1
    i = 0
    
print(cnt)

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

Solution (Python):
class Combination:
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fac = [1 for i in range(self.n + 1)]
        self.finv = [1 for i in range(self.n + 1)]
        for i in range(2, self.n+1):
            self.fac[i] = (self.fac[i - 1] * i) % self.mod
            self.finv[i] = (self.finv[i - 1] * pow(i, -1, self.mod)) % self.mod

    def comb(self, n, m):
        return self.fac[n] * (self.finv[n - m] * self.finv[m] % self.mod) % self.mod
        
def iparse():
    return list(map(int, input().split()))

def RLE(s):
    res = []
    prev = ""
    cnt = 0
    for e in s:
        if prev == "":
            prev = e
            cnt += 1
        elif prev == e:
            cnt += 1
        else:
            res.append((cnt,prev))
            prev = e
            cnt = 1
    res.append((cnt,prev))
    return res


if __name__ == "__main__":
    s = input()
    rle = RLE(s)
    
    print(len(rle)-1)

Solution (Python):

S = input()
S = S + '1'


cnt = []
conti = 1
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        conti += 1
    else:
        cnt.append(conti)
        conti = 1
print(len(cnt)-1)

Solution (Python):
def main():
    *S, = input()
    c = S.pop()
    ans = 0
    while S:
        if (nc := S.pop()) == c:
            continue
        c = nc
        ans += 1
    print(ans)


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):
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  


S = LS2()
N = len(S)

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

s = input()
now = -1
res = -1
for x in s:
    if now != x:
        res += 1
        now = x
print(res)

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

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

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

Solution (Python):
S = str(input())
N = len(S)
D = [0,0] 
ans = 0; prev = S[0]
for i in range(N):
  if S[i] == "B":
    D[0] += 1
  else:
    D[1] += 1
  if i >= 1:
    if S[i] == prev:
      continue
    else:
      ans += 1
      prev = S[i]
if D[0] == 0: 
  print(0); exit()
elif D[1] == 0:
  print(0); exit()
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()
cnt = 0
now = S[0]

for i in S:
    if i != now:
        now = i
        cnt += 1
print(cnt)

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  


S = LS2()
N = len(S)

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

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

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

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

print(count)

Solution (Python):
from collections import Counter
S = input()

c = Counter(S)
if c['W'] == 0 or c['B'] == 0:
    print(0)
    exit()

now = ''
count = 0
for i in range(len(S)):
    if i == 0:
        now = S[i]
        continue
    if now == S[i]:
        continue
    else:
        count += 1
        now = S[i]
        continue

print(count)

Solution (Python):
def main():
    ss = input()
    put_stone = ''
    count = 0
    for stone in ss:
        if put_stone != '' and put_stone == stone:
            count += 1
        if stone == 'B':
            put_stone = 'W'
        else:
            put_stone = 'B'
    print(count)

if __name__ == '__main__':
    main()

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

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

print(Sum)

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    lst = [s[0]]

    for char in s[1:]:
        if lst[-1] != char:
            lst.append(char)

    ans = len(lst)-1
    print(ans)
main()

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

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

Solution (Python):
S = input()
now = 1
cnt = 0
for s in S:
    if s != now:
        now = s
        cnt += 1
print(cnt -1)

Solution (Python):
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right 
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x):
        self.setdefault(x,0)
        self[x] += 1
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

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

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

x = len(S)
if S.count("B") == x or S.count("W") == x:
    print(0)
    exit()



cntw=0
for s in S.split("W"):
    if s:
        cntw += 1
cntb=0
for s in S.split("B"):
    if s:
        cntb += 1
print(abs(cntb - cntw) + min(cntb, cntw) * 2 - 1)

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



def runLengthEncode(S: str):
    grouped = groupby(S)
    res = []
    for k, v in grouped:
        res.append((k, str(len(list(v)))))
    return res



def runLengthDecode(L: "list[tuple]"):
    res = ""
    for c, n in L:
        res += c * int(n)
    return res



def rle_list(S: str):
    grouped = groupby(S)
    res = ""
    for k, v in grouped:
        res += k
    return res


def main():
    ss = input()
    rle = rle_list(ss)
    ans = len(list(rle)) - 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

input = sys.stdin.readline
S = input()
S = S.replace('\n' , '')
tmp = ""
division_count = 0
for s in S:
    if tmp == "":
        tmp = s
        continue
    if tmp == s:
        continue
    else:
        tmp = s
        division_count += 1
print(division_count)

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

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

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

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

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

Solution (Python):
s=input()
ans=[]
pre=""
for i in s:
    if pre!=i:
        ans.append(i)
        pre=i

print(len(ans)-1)

Solution (Python):
S = input()
l = len(S)
ans = sum(a != b for a,b in zip(S[:l-1],S[1:]))
print(ans)

Solution (Python):
S = input()
c = 0

bs = '_'
for s in S:
  if s != bs:
    c += 1
    bs = s

print(c - 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
def input(): return sys.stdin.readline().strip()

def main():
    S = input()
    pre = S[0]
    ans = 0
    for i, c in enumerate(S):
        if i == 0: continue
        if c != pre:
            ans += 1
            pre = c
    print(ans)

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):
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    s = s_input()
    ans = 0
    trial = s[0]
    for i in s[1:]:
        if trial != i:
            ans += 1
            trial = i
    print(ans)


if __name__=="__main__":
    main()

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

Solution (Python):
S=input()
i=1
l=len(S)
res=0
f=S[0]

while i<l:
  if (S[i] == f):
        i+=1
  else:
    res+=1
    f=S[i]
    i+=1
print(res)

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


if __name__ == '__main__':
    main()

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = 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
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """BBBWW"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """WWWWWW"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """WBWBWBWBWB"""
        output = """9"""
        self.assertIO(input, output)


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

    i = 1
    while i < len(S):
        if S[i] == S[i-1]:
            del S[i]
        else:
            i += 1

    print(len(S)-1)


if __name__ == "__main__":
    
    resolve()

Solution (Python):
S = list(input())
k = S.pop(0)
ii = 0
for i in S:
    if k == i:
        pass
    else:
        ii += 1
        k = i
print(ii)

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

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

Solution (Python):
from itertools import groupby
s = input()
count = 0
for k, g in groupby(s):
    count += 1
print(count - 1)

Solution (Python):
s= input()
color = "chokudai"
d = []

for c in s:
    if c != color:
        d.append(c)
        color = c
print(len(d)-1)

Solution (Python):
from itertools import groupby

s = input()

cnt = 0

for k, g in groupby(s):
    cnt += 1

print(cnt - 1)

Solution (Python):
stack = []
for l in raw_input():
	if len(stack) == 0 or stack[-1] != l: stack.append(l)
print len(stack) -1

Solution (Python):
S = list(input())
count = 0
t = ''
for i in S:
    if t == i:
        continue
    else:
        t = i
        count += 1
print(count - 1)

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

Solution (Python):
s = input()

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

print(res)

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

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

print(ans)

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

Solution (Python):
s = list(input())
n = len(s)
b = False
if s[0] == "B":
    b = True

ans = 0
for i in range(1, n):
    if b and s[i] == "W":
        b = False
        ans += 1
    elif not b and s[i] == "B":
        b = True
        ans += 1
print(ans)

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

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

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

for i in range(l-1):
  if s[i]==s[i+1]:
    s[i]='0'
    
print(s.count('B')+s.count('W')-1)

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

s = S.replace('WB', 'W B').replace('BW', 'B W')
s = list(s.split())
print(len(s) -1)

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

Solution (Python):
a=input()+"p"
b=0
i=1
c=a[0]
while a[i]!="p":
  if a[i]!=c:
    c=a[i]
    b+=1
  i+=1
print(b)

Solution (Python):
S=list(input())
c=0;m=''
for i in S:
    if i!=m:
        m=i
        c+=1
print(c-1)

Solution (Python):
s = input()
cnt = 0
cur = s[0]
strk = 1

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

cnt += 1

print(cnt-1)

Solution (Python):
s = input()

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

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

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

Solution (Python):

def main():
    s = input()
    t = s[0]
    cnt = 1

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

if __name__ ==  "__main__":
    main()

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

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

print(ans)

Solution (Python):
s = input()
ch = s[-1]
index = len(s) - 1
answ = 0
while index >= 0:
    if s[index] != ch:
        answ += 1
        ch = 'B' if ch == 'W' else 'W'
    else:
        index -= 1
print(answ)

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

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

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

Solution (Python):
S=input()

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

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

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

Solution (Python):






def calcDivision(s):
  res = 0
  prev = ""
  for i in range(len(s)):
    if s[i] == prev:
      pass
    else:
      if prev == "":
        pass
      else:
        res += 1
    prev = s[i]
  return res


def solve(s):
  return calcDivision(s)



def main():
  s = input()
  print(solve(s))
  return

if __name__ == '__main__':
  main()

Solution (Python):






def calcGroup(s):
  whiteCount = 0
  blackCount = 0
  prev = ""
  for i in range(len(s)):
    if s[i] == prev:
      pass
    else:
      if s[i] == "W":
        whiteCount += 1
      elif s[i] == "B":
        blackCount += 1
      else:
        raise ValueError
    prev = s[i]
  return whiteCount,blackCount


def solve(s):
  white,black = calcGroup(s)
  if abs(white-black) == 0:
    return (white-1)*2+1
  else:
    return min(white,black)*2



def main():
  s = input()
  print(solve(s))
  return

if __name__ == '__main__':
  main()

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

print(sum(sikii))

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

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

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

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

Solution (Python):
s = input()

min_value = 10 ** 9


pivot = s[0]
result = 0
for c in s:
  if pivot != c:
    pivot = c
    result += 1
min_value = min(min_value, result)


result = 0
for c in reversed(s):
  if pivot != c:
    pivot = c
    result += 1
min_value = min(min_value, result)
print(min_value)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

S = list(input())+['END']
lis = []
now = S[0]
for s in S[1:]:
    if s!=now:
        lis.append(now)
        now = s

print(len(lis)-1)

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


result = 0


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

print(result)

Solution (Python):
s = list(input())
s.append('X')
cnt = 0
for n in range(len(s)-1):
	if s[n] != s[n+1]:
		cnt += 1
print(cnt - 1)

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

Solution (Python):
S = input()
pre = "X"
B, W = 0, 0
for s in S:
    if s != pre:
        if s == "B":
            B += 1
        else:
            W += 1
        pre = s

if B == 0 or W == 0:
    print(0)
elif B == W:
    print(B * 2 - 1)
else:
    x, y = min(B, W), max(B, W)
    print(x * 2)

Solution (Python):
s = input()

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

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

print(cnt)

Solution (Python):
S=str(input())
n=0
ch=S[0]
for s in S:
    if ch!=s:
        n+=1
    ch=s
print(n)

Solution (Python):




S = input()






s = S[0]

r = 0

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

    s = S[i]

print(r)

Solution (Python):
S=input()

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

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

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

Solution (Python):

s = input()
print(sum(s[i - 1] != s[i] for i in range(1, len(s))))

Solution (Python):
from itertools import groupby

S=input()
G=groupby(S)
g=[len(list(i)) for i,_ in G]
print(sum(g)-1)

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

Solution (Python):
import collections


def main():
    S = input()
    cnt = 0
    tmp = ""
    for s in S:
        if s != tmp:
            cnt += 1
        tmp = s

    print(cnt - 1)


if __name__ == "__main__":
    main()

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

Solution (Python):
S=input()
if len(S)==max(S.count('W'),S.count('B')):
    print(0)
    exit()
else:
    t=''
    cnt=0
    for i in S:
        if i!=t:
            cnt+=1
            t=i

    print(cnt-1)

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

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