Problem:
 Score : 300 points    Problem Statement There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i -th slime from the left has the color that corresponds to the i -th character of S .  Adjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.  Ultimately, how many slimes will be there?      Constraints  1 \leq N \leq 10^5  |S| = N  S consists of lowercase English letters.         Input Input is given from Standard Input in the following format:  N  S       Output Print the final number of slimes.        Sample Input 1 10
aabbbbaaca      Sample Output 1 5  Ultimately, these slimes will fuse into abaca .       Sample Input 2 5
aaaaa      Sample Output 2 1  All the slimes will fuse into one.       Sample Input 3 20
xxzaffeeeeddfkkkkllq      Sample Output 3 10

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

Solution (Python):
N = int(input())
S = input()
tmp, val = '', []
for i in S:
    if i !=tmp:
        val.append(i)
        tmp = i
print(len(val))

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

ans=''
for i in range(n-1):
  if s[i]==s[i+1]:
    pass
  else:
    ans+=s[i]
    
ans+=s[-1]

print(len(ans))

Solution (Python):
n = int(input())
s = input()
ans = 0
p = None
for letter in s:
    if letter != p:
        p = letter
        ans += 1
print(ans)

Solution (Python):
N = int(input())
S = input()
tmp = S[0]
ans = 1
for n in range(1,N):
  if S[n] != tmp:
    ans += 1
    tmp = S[n]
print(ans)

Solution (Python):
N = int(input())
S = input() + "Z"

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

Solution (Python):
def remove_slimes(ls):
	l = [ls[0]]
	for i in range(1, len(ls)):
		if ls[i-1] != ls[i]:
			l.append(ls[i])
	return len(l)

n = int(input())
s = input()
cnt = 1
if len(s) != 1:
	cnt = remove_slimes(list(s))
print(cnt)

Solution (Python):
N = int(input())
S = input()
ans = 1

for n in range(1,N):
  if S[n-1]!=S[n]:
    ans+=1
    
print(ans)

Solution (Python):
n = int(input())
s = input()
x = n
for i in range(n-1):
    if s[i] == s[i+1]:
        x -= 1
print(x)

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

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

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

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

Solution (Python):
n = int(input())
c = input()
ans = 1

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

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


current = ""
ans = ""
for s in S:
    if s != current:
        current = s
        ans += s

print(len(ans))

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

Solution (Python):

N = int(input())
S = str(input())
ans = 1
s = list(map(str, str(S)))

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

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

ans = 0
buf = ""
for l in S:
    if buf != l:
        buf = l
        ans += 1
    else:
        pass
print(ans)

Solution (Python):
rst = []
N = int(input())
S = input()
tmp_val = ''
for i in S:
    if tmp_val != i:
        rst.append(i)
        tmp_val = i
print(len(rst))

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


count = 0
color = ''
for c in S:
  if c != color:
    color = c
    count += 1
print(count)

Solution (Python):
N=(int(input()))
S=(str(input()))
ans=1
for i in range(1,N):
  if S[i]==S[i-1]:
    continue
  else:
    ans+=1
print(ans)

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

c=n

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

print(c)

Solution (Python):
N = int(input())
S = input()
S = list(S)
color = [0]
j = 0
for i in range(1,N) :
    if S[i-1] == S[i] :
        color.append(j)
    else :
        j += 1
        color.append(j)

print(len(set(color)))

Solution (Python):
N=int(input())
S=list(input())
ans=[]

while len(S)>1:
	if S[0]==S[1]:
		S.pop(0)
	else:
		ans.append(S.pop(0))

print(len(ans)+1)

Solution (Python):
import sys

n=int(input())
a=input()
a=list(a)
a.reverse()
if n==1:
    print('1')
    sys.exit()
    
c=1


for i in range(n-1):
    if a[i]!=a[i+1]:
        c+=1

if c==0:
    c+=1
    
print(c)

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

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

Solution (Python):
n = int(input())
s = input()
slime_end = "0"
num = 0
for i in range(n):
    if s[i] != slime_end:
        num += 1
        slime_end = s[i]
print(num)

Solution (Python):
N=int(input())
S=input()
now=0
num=0
for char in S:
    if char!=now:
        num+=1
        now=char
print(num)

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

Solution (Python):
N=int(input())
S=list(map(str,input()))
ans=1
for i in range(N-1):
    if S[i]!=S[i+1]:
        ans+=1
print(ans)

Solution (Python):
N=int(input())
S=list(map(str,input()))
i=0
while i!=(len(S)-1):
    if S[i]==S[i+1]:
        S.pop(i+1)
    else:
        i+=1
print(len(S))

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

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

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

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

print(count+1)

Solution (Python):
N = int(input())
S = input()
i = 0
count = 1
con_s = 0

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

Solution (Python):
N=int(input())
S=input()
x=1
for i in range(0,N):
    if i<N-1 and S[i]!=S[i+1] :
        x=x+1
print(x)

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

Solution (Python):
n=int(input())
s=list(input())
for i in range(len(s)-1,0,-1):
    if s[i]==s[i-1]:
        s.pop(i)
print(len(s))

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

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

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

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

Solution (Python):
n = int(input())
bef = ""
ans = 0
for s in input():
  if bef != s:
    ans += 1
    bef = s
print(ans)

Solution (Python):

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

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

Solution (Python):
N = int(input())
slimes = input()

count = 1
current = None

for s in slimes:
  if current is None:
    current = s
    next
  if current != s:
    count +=1
  current = s
    
print(count)

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

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

Solution (Python):
n = int(input())
x = list(input())
count = n
for i in range(n-1):
  if x[i]==x[i+1]:
    count-=1
print(count)

Solution (Python):
N = int(input())
S = input()
count = 1
check = S[0]

for c in S:
  if c != check:
    count += 1
    check = c

print(count)

Solution (Python):
import itertools
n = int(input())
S = list(input())
L = [k for k, v in itertools.groupby(S)]
print(len(L))

Solution (Python):
n = int(input())
s = str(input())
count = 1

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

print(count)

Solution (Python):
n = int(input())
slimes = input()
fusion = [slimes[0]]

cnt = 0

for i in range(1,n):
    if fusion[cnt] != slimes[i]:
        fusion.append(slimes[i])
        cnt += 1

print(cnt+1)

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

Solution (Python):
n = int(input())
s = input()
for i in range(n-1):
  if s[i] == s[i+1]:
    s = s[:i] + " " + s[i+1:]
print(len(s.replace(" ", "")))

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

Solution (Python):
N = int(input())
S = list(input())
cn = 1

for i in range(N-1):
    if S[i] == S[i+1]:
        continue
    else:
        cn = cn + 1
        
print(cn)

Solution (Python):
def abc143c_slimes():
    n = int(input())
    s = input()
    cnt = 1
    for i in range(n-1):
        if s[i] != s[i+1]:
            cnt += 1
    print(cnt)
abc143c_slimes()

Solution (Python):
n = int(input())

s = input()

ans = 1

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

print(ans)

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

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

Solution (Python):
num = int(input())
str1 = input()
table = list(str1)
ans = []

for i in range(num-1):
    if table[i] == table[i+1]:
        continue
    else:
        ans.append(table[i])

print(len(ans) + 1)

Solution (Python):
n = int(input())
s = [i for i in input()]
result  = []
tmp = '¥'
for i in range(0,n):
    if tmp != s[i]:
        result.append(s[i])
        tmp = s[i]
print(len(result))

Solution (Python):
n=int(input())
s=input()
num=n
for i in range(1,n):
    if s[i-1]==s[i]:
        num-=1
print(num)

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

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

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

print(ANS + 1)

Solution (Python):
n = int(input())
s = str(input())
ans = n
for i in range(1,n):
    if s[i-1] == s[i]:
        ans -= 1
print(ans)

Solution (Python):
N = int(input())
S = str(input())
count = 1

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

print(count)

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

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



for x in range(1,n):
  if s[x] == s[x-1]:
    n -= 1

print(n)

Solution (Python):


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

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

N = int(input())
S = ['_']+list(input())

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

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

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

print(ans)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq














import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7


from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
s = input()
ans = ""
prv = None
for i in range(n):
    if i == 0:
        prv = s[i]
        ans += s[i]
        continue
    if s[i] == prv:
        continue
    else:
        prv = s[i]
        ans += s[i]
print(len(ans))

Solution (Python):
N = int(input())
S = input()
now = -1
for s in S:
    if now == s:
        N -=1
    now = s
print(N)

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

res = ""
pre = ""
for s in S:
    if pre != s:
        res += s
    pre = s

print(len(res))

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

Solution (Python):
n = int(input())
s = input()
ans = 0
i = 0
while i < n:
    ans += 1
    while i + 1 < n and s[i] == s[i + 1]:
        i += 1
    i += 1
print(ans)

Solution (Python):
import itertools
N = int(input())
S = list(input())
gr = list(itertools.groupby(S))
print(len(gr))

Solution (Python):
N = int(input())
S = input().strip()
cnt = 1
for i in range(1,N):
    if S[i]!=S[i-1]:
        cnt += 1
print(cnt)

Solution (Python):
N = int(input())
S = input()
pre = S[0]
ans = 1

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

Solution (Python):
n = int(input())
S = input()
ans = ""
for s in S:
    if ans == "" or ans[-1] != s: ans += s
print(len(ans))

Solution (Python):
N=int(input())
arr=list(map(str,input()))

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

Solution (Python):
N = int(input())
S = input()
s = S[0]
ans = 1

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

print(ans)

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



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

print(ans)

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





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

print(ans)

Solution (Python):

"""
Created on Wed Sep  9 02:34:35 2020

@author: liang
"""

N = int(input())
S = input()

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

Solution (Python):
N = int(input())
S = list(input())
A = [0] * N
same = False
import math
for i in range(1, N):
  if S[i] == S[i-1]:
    same = True
  elif same and S[i] != S[i-1]:
    A[i] = 1
    same = False
  else:
    same = False
    A[i] = 1
    
print(sum(A)+1)

Solution (Python):


from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int, S: str):
    return len([c for i, c in enumerate(S) if i == 0 or c != S[i-1]])


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = next(tokens)  
    print(f'{solve(N, S)}')


if __name__ == '__main__':
    main()

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

print(ans)

Solution (Python):
N = int(input())
a = list(input())
count = 1
for i in range(N):
  if i>0:
    if a[i-1]==a[i]:
      pass
    elif a[i-1]!=a[i]:
      count+=1
      
print(count)

Solution (Python):
def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    s = readline().rstrip().decode('utf-8')

    l = ''
    ans = 0
    for i in s:
        if i != l:
            l = i
            ans += 1 
    print(ans)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
n = int(input())
s = input()
ans = n

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

Solution (Python):
n = int(input())
word = input()
answer = 0
for i in range(n-1):
    if word[i] != word[i+1]:
        answer += 1
print(answer+1)

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

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

judge = [1]*N

for i in range(1,N):
    if S[i-1] == S[i]:
        judge[i] = 0

print(sum(judge))

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

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

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

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


ans = 0
pre = None
for s in S:
    ans += (pre != s)
    pre = s
print(ans)

Solution (Python):
n=int(input())
s=input()
z=n
for i in range (1,n):
  if s[i-1]==s[i]:
    z-=1
print(z)

Solution (Python):
N = int(input())
S = list(input())
ans = [S[0]]
for i in range(1, N):
  if S[i-1] != S[i]:
    ans.append(S[i])
print(len(ans))

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

K=0
A="*"
for s in S:
    if s!=A:
        A=s
        K+=1
print(K)

Solution (Python):
N = int(input())
S = input()
ans = 0
prev = -1
for s in S:
  if prev != s:
    ans+=1
    prev=s
print(ans)

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

Solution (Python):
N = int(input())
S = str(input())
cnt = 1

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

print(cnt)

Solution (Python):

from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

def main():
    N = I()
    S = SL()

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


if __name__ == '__main__':
    main()

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

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

print(cnt)

Solution (Python):
n=int(input())
s=input()
ans=1
mark=s[0]
for a in s:
    if a!=mark:
        mark=a
        ans+=1
print(ans)

Solution (Python):
N = int(input())
S = input()
S = [i for i in S]

cnt = 1
Cnt = []

for i in range(1, N):
    if S[i]==S[i-1]:
        cnt += 1
    elif S[i]!=S[i-1]:
        Cnt.append(cnt)
        cnt = 1
Cnt.append(cnt)
print(len(Cnt))

Solution (Python):

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    cnt=0
    N=I()
    S=input()
    now="A"
    for i in range(N):
        if S[i]!=now:
            cnt+=1
        now=S[i]
        
    print(cnt)

main()

Solution (Python):
def main():
    n = int(input())
    s = input()

    cnt = 1

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

    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from itertools import groupby

    N = int(readline())
    S = input()
    ans = 0
    for g in groupby(S):
        ans += 1

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=input()
s=list(a)
b=list(a)
j=0
for i in range(0,n-1):
    if s[i]==s[i+1]:
        b.pop(i-j)
        j=j+1
    else:
        pass
print(len(b))

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

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

print(ans)

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

Solution (Python):


n = int(input())
slimes = input()
res = 1
for i in range(1, n):
    if slimes[i-1] != slimes[i]:
        res += 1
print(res)

Solution (Python):
n=int(input())
s=input()
k=0
l=set(s)
k=s[0]
ans=1
if len(l)==1:
    print("1")
    exit()
for i in range(1,n):
    if k!=s[i]:
        ans+=1
        k=s[i]
print(ans)

Solution (Python):
a=int(input())
b=input()
c=0
for i in range(a-1):
  if b[i]==b[i+1]:
    c=c+1
print(a-c)

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

Solution (Python):
N=int(input())
S=input()
l=[]
for i in range(N-1):
    if S[i]!=S[i+1]:
        l.append(S[i])
l.append(S[N-1])
print(len(l))

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

Solution (Python):
a = int(input())
b = input()
c = 1
for i in range(a-1):
  if b[i] != b[i+1]:
    c += 1
print(c)

Solution (Python):
n = int(input())
s = str(input())
s += "A"
q = s[0]
ans = 0
for i in range(n+1):
  if(q==s[i]):
    None
  else:
    ans += 1
    q = s[i]
print(ans)

Solution (Python):
N = int(input())
S = list(input())
n = 1
for i in range(1, N):
	if S[i-1] != S[i]:
		n += 1
print(n)

Solution (Python):
n = int(input())
s = input()
S = []
for i in s:
    S.append(i)
from collections import deque
q = deque(S)
ans = []
while q:
    c  =q.popleft()
    if not ans:
        ans.append(c)
    else:
        while ans and ans[-1]==c:
            ans.pop()
        ans.append(c)

print(len(ans))

Solution (Python):
n = int(input())
s = input()
ans = n

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

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

cnt = 0
sum = len(S)


for i in range(N-1):

  
  if S[i] == S[i+1]:
  	cnt += 1
  else:
  	continue

ans = sum - cnt

print(ans)

Solution (Python):
N = int(input())

S = input()

ans = []

for i in range(N):
    p = S[i]

    if i != N - 1:
        if p != S[i+1]:
            ans.append(S[i])
        else:
            continue
    else:
        ans.append(S[i])

print(len(ans))

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

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

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

Solution (Python):
def main():
    N = int(input())
    S = input()

    temp = S[0]
    result = 1
    for i in range(1,N):
        if temp != S[i]:
            result += 1
            temp = S[i]

    print(result)

if __name__ == '__main__':
    main()

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

for i in reversed(range(1,n)):
    if s[i-1]==s[i]:
        s.pop(i)

print(len(s))

Solution (Python):
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

n = ni()
s = input()
cnt = 0
prev=""
for i in range(n):
    if prev==s[i]:
        pass
    else:
        cnt+=1
    prev=s[i]
print(cnt)

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

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

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

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

print(cnt)

Solution (Python):
n = int(input())
d = input()

x = d[0]
count = 1
for i in d:
    if i != x:
        count += 1
        x = i
print(count)

Solution (Python):
N = int(input())
S = input()
ans = [S[0]]
for i in range(1, N):
    if S[i]==ans[-1]:
        continue
    else:
        ans.append(S[i])
print(len(ans))

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

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

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    S=list(input())

    pre = None
    X = []
    for s in S:
        if s != pre:
            X.append(s)

        pre = s
    
    print(len(X))






if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


N = int(input())
S = input()

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

print(ans)

Solution (Python):
n = int(input())
s = str(input())
w = s[0]
num = 0
for i in range(1,n):
    if w[0] == s[i]:
        w += s[i]
    else:
        num += 1
        w = s[i]
num += 1
print(num)

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

ans = 0
before = ""
for i in s:
    if i != before:
        ans += 1
        before = i

print(ans)

Solution (Python):
from itertools import groupby
n = int(input())
s = input()

gr = groupby(s)
ans = 0
for key, value in gr:
    ans += 1

print(ans)

Solution (Python):


import math

import itertools
from collections import deque
from collections import Counter
import heapq


import bisect
n=int(input())
s=input()
ans=n
for i in range(1,n):
    if s[i]==s[i-1]:
        ans-=1
print(ans)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy








def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
s = input()
pre = ''
ans = 0
for t in s:
    if(pre != t):
        ans += 1
    pre = t
print(ans)

Solution (Python):
N = int(input())
s = input()
cnt = 1
i = 1
while (i < N):
    if s[i] != s[i-1]:
        cnt += 1
    i += 1
print(cnt)

Solution (Python):
N = int(input())
sList = list(input())
count = 0
tmp = ''
for s in sList:
    if(s != tmp):
        count += 1
        tmp = s

print (count)

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

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

print(cnt)

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

Solution (Python):
N = int(input())
S = input()
anchor = ''
ans = 0

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

print(ans)

Solution (Python):
a = int(input())
s = input()
ans = ''
for i in range(a-1):
    if s[i] == s[i+1]:
        continue
    else:
        ans += s[i]
ans += s[-1]

print(len(ans))

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




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

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


if __name__ == "__main__":
    main()

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

i=0
while i<n:
    j=i
    ans+=1
    while j<n and s[j]==s[i]:
        j+=1
    i=j

print(ans)

Solution (Python):
N=int(input())
S = input()
List = list(S)
resList = [S[0]]
for i in range(1,N):
  if List[i] == List[i-1]:
    pass
  else:
    resList.append(List[i])
print(len(resList))

Solution (Python):
N = int(input())
S = input()
fused = [S[0]]
for i in range(len(S)):
  if S[i] != fused[-1]:
    fused.append(S[i])

print(len(fused))

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

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

cnt = 0
for i in d:
    i -= cnt
    del S[i]
    cnt += 1
    
print(len(S))

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

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

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

Solution (Python):
n = int(input())
s = input()
memo = ""
for i in s:
  if memo == i:
    n-=1
  else:
    memo=i
print(n)

Solution (Python):
n = int(input())
s = input()
prev = ""
ans = ""
for i in range(n):
    if s[i] == prev:
        continue
    prev = s[i]
    ans += s[i]
print(len(ans))

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

Solution (Python):
N = int(input())
S = input()
A = ['']
for i in S:
    if i != A[-1]:
        A.append(i)
print(len(''.join(A)))

Solution (Python):
n=int(input())
s=list(input())
c=0
out=0
for i in range(0,n-1):
    if s[i]==s[i+1]:
        c+=1
    else:
        out+=c
        c=0
out+=c
out=n-out
print(out)

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

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

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

Solution (Python):


n = int(input())

s = input()

ans = 1
tmp = s[0]

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

print(ans)

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

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

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

cnt = 1
col = S[0]

for c in S:
    if(c != col):
        cnt += 1
        col = c

print(cnt)

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

ans=1
tmp=S[0]

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

    
print(ans)