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

tmp = s[0]
c = 1

for i in range(1,n):
    if s[i] == tmp:
        continue
    else:
        tmp = s[i]
        c += 1

print(c)

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

loop_flg = True
while loop_flg:
    s_length = len(S)
    next_s = [s for i, s in enumerate(S) if S[i+1:i+2] != s]
    if s_length == len(next_s):
        loop_flg = False
    else:
        S = next_s

print(len(S))

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

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

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(cnt+1)

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

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

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

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

    print(ans+1)


if __name__ == '__main__':
    main()

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

S = list(input())

                
i = 0
while i != len(S) - 1:
    if S[i] == S[i+1]:
        S.pop(i)
    else:
        i += 1
print(len(S))

Solution (Python):
n = int(input())
s = input()
res = ""
x = ""
for l in s:
  if l != x:
    x = l
    res += x
  else: pass
print(len(res))

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

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

Solution (Python):
N = int(input())
li = list(input())
for i in range(N-1):
  if li[i] == li[i+1]:
    li[i] = "P"
p = li.count("P")
print(N-p)

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

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

Solution (Python):
n = int(input())
S = str(input())
cnt = 1
num =0
for i in range(n):
  if S[num] != S[i]:
    num = i
    cnt += 1

print(cnt)

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

rslt = [S[0]]
S = [i for i in S[1:]]

for i in S:
    if rslt[-1] != i:
        rslt.extend(i)

print(len(rslt))

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

main()

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

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):
import math
import sys
input = sys.stdin.readline


def main():
    sc = Scan()
    n = sc.intarr()[0]
    s = sc.strarr()[0]
    ans = ''
    before = s[0]
    for i in range(1, n):
        c = s[i]
        if before != c:
            ans += before
            before = c

    ans += before
    print(len(ans))


class Scan():

    def intarr(self):
        line = input()
        array = line.split(' ')
        num_array = [int(n) for n in array]
        return num_array

    def strarr(self):
        line = input()
        array = line.split(' ')
        array[-1] = array[-1].strip('\n')
        return array


main()

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

ans = 1

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

print(ans)

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

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

prev = ''
new = []
for c in s:
    if prev != c:
        new.append(c)
    prev = c

print(len(new))

Solution (Python):
slime=int(input())
color=input()
col=list(color)
ret=list()
count=0

ret.append(col[0])
for i in range(1,slime):
  if ret[count]!=col[i]:
    ret.append(col[i])
    count=count+1

print(len(ret))

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

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

Solution (Python):
N = int(input())
S = input()
prev = ""
ret = 0
for s in list(S):
    if not s == prev:
        ret += 1
    prev = s
print(ret)

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

Solution (Python):
n = int(input())
s = list(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()

S += "."

G = ""

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

print(len(G))

Solution (Python):
n = int(input())
s = input()
i = 0
num = n
while i + 1 < n:
    if s[i] == s[i+1]:
        num -= 1
    i += 1
print(num)

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

slime = 1

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

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

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

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

Solution (Python):

import sys
from collections import deque

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = input()
s = input()

temp = ''
dq = deque()
for _ in s:
    if _ != temp:
        dq.append(_)
    temp = _
ans = len(dq)

print(ans)

Solution (Python):
def main():
    n = int(input())
    s = input()
    prev = ''
    cnt = 0
    for i in range(len(s)):
        if s[i] != prev:
            cnt += 1
            prev = s[i]
    print(cnt)


if __name__ == '__main__':
    main()

Solution (Python):


n = int(input())
s = input()
cnt = 1

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

print(cnt)

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

result = 1

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

print(result)

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

S = input()

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

print(count)

Solution (Python):
import numpy as np

n = int(input())

s = input()

c = 0
s0 = ''
for s_ in s:
    if s0 != s_:
        c += 1
        s0 = s_
      
print(c)

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())
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()
sum=1
i=1
str=s[0]
while i<=n-1:
  if str == s[i]:
    i+=1
  else:
    str=s[i]
    sum+=1
    i+=1
    
print(sum)

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

count = 1
last = S[0]
for n in range(1,N):
  
  if S[n] == last:
    pass
  else:
    count += 1
    
  last = S[n]
  
print(count)

Solution (Python):

N = int(input())
S = input()
check = ''
count = 0
for i in range(N):
    if check == S[i]:
        count+=1
    else:
        check = S[i]
print(N-count)

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

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

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

res=[S[0]]
for i in range(1,N):
  if S[i]!=res[-1]:
    res.append(S[i])
    
print(len(res))

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

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

ans = 1
f = s[0]
for i in s[1:]:
    if f == i:
        continue
    else:
        f = i
        ans += 1
print(ans)

Solution (Python):
n=int(input())
s=input()
ret=s[0]

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

Solution (Python):

import numpy as np

n = int(input())
s = list(input())


ans = 1

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

print(ans)

Solution (Python):
num=int(input())
data=list(input())
 
count=1
for i in range(num-1):
  if data[i] is not data[i+1]:
    count+=1
print(count)

Solution (Python):
N = int(input())
s = list(input())
s_new = []

i = 0
s_new.append(s[i])
while True:
    if i + 1 >= N:
        break
    i += 1
    if s[i] != s_new[-1]:
        s_new.append(s[i])

print(len(s_new))

Solution (Python):

import numpy as np

n = int(input())
s = list(input())

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

print(ans)

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

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

print(c + 1)

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):
N = int(input())
S = list(input())
num = 0
str1 = ""
for x in S:
    if x != str1:
        num +=1
        str1 = x
print(num)

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

prev = ''
counter = 0
for s in S:
    if s == prev:
        counter += 1
    prev = s
print(len(S) - counter)

Solution (Python):
N = int(input())
s = str(input())
i = 1
ps = s[0]
ans = 1
while (i<N):
    if s[i]!=ps:
        ps = s[i]
        ans+=1
    i+=1
print(ans)

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

ans = [a[0]]
for i in range(1,len(a)):

    if a[i] != a[i - 1]:
        ans.append(a[i])

print(len(ans))

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

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


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

print(sum)

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 = list(str(input()))
a = ''
ans = 0
for i in range(n):
  if s[i] != a:
    a = s[i]
    ans += 1
print(ans)

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

unique = set(s)
for i in unique:
    s = re.sub(i+'+',i,s)
print(len(s))

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

print(len(list))

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

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

print(n)

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys
import bisect

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

def LI(): return list(map(int, sys.stdin.readline().split()))

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

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

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

ans = 0
previous_s = -1
for s in S:
    if s != previous_s:
        ans += 1
    previous_s = s

print(ans)

Solution (Python):
import itertools
N = input()
S = input()

count = 0

gr = itertools.groupby(S)
for key, group in gr:
    
    count += 1
print(count)

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

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

Solution (Python):
from itertools import groupby
n = input()
s = input()
ans = 0
for _, _ in groupby(s):
    ans+=1
print(ans)

Solution (Python):
N = int(input())
S = input()
postc = ''
answer = 0
for c in S:
    if c != postc:
        answer += 1
    postc = c
print(answer)

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

ans = 0
last = ""
for i in range(N):
    if S[i] == last:
        continue
    else:
        ans += 1
        last = S[i]
print(ans)

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

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

print(count)

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

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

Solution (Python):

if __name__ == '__main__':

	n = int(input())
	A = input()
	B = ""
	end = ""

	for i in A:
		if end != i:
			B += i
			end = i

	print(len(B))

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

ans = 1

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

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
from itertools import groupby
def print_ans(input_line):
    """Test Case
    >>> print_ans("aabbbbaaca")
    5
    >>> print_ans("aaaaa")
    1
    >>> print_ans("xxzaffeeeeddfkkkkllq")
    10
    """
    print(len(list(groupby(input_line))))

if __name__ == '__main__':
    N = int(input().rstrip())
    s = input().rstrip()
    print_ans(s)

Solution (Python):
input()
s = input()
ss = set(s)

for i in ss:
    s = s.replace(i*2, i)
    a = s.replace(i*2, i)
    while s != a:
        s = a
        a = s.replace(i*2, i)

print(len(s))

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

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

Solution (Python):
import numpy as np
n = int(input())
s = [ord(i) for i in input()]
print(np.sum(np.diff(s)!=0)+1)

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

T = "_"

for s in S:
    if T[-1] == s:
        continue
    else:
        T += s

T = T[1:]
print(len(T))

Solution (Python):
def calculate(S):
    arr = list(S)

    if len(arr) == 0:
        return 0

    if len(arr) == 1:
        return 1

    N = len(arr)

    tmp = 1
    for i in range(1,N):
        if arr[i] != arr[i-1]:
            tmp = tmp + 1
    return tmp

N = input()
S = input()
res = calculate(S)
print(res)

Solution (Python):
N = int(input())
colors = list(input())
before = ""
ans = 0
for color in colors:
  if color != before:
    ans += 1
    before = color
print(ans)

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

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

print(N - res)

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

Solution (Python):


a = int(input())
s = input()

ans = 0
prev = ""

for i in range(0, a):
  cur = s[i]
  if cur != prev:
    ans += 1
    
  prev = cur
  
print(ans)

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

Solution (Python):

N = int(input())
S = input()
s = list(S)
count = 0
for i in range(N-1):
    if s[i] == s[i+1]:
        count += 1

print(len(s)-count)

Solution (Python):
from collections import deque

n = int(input())
s = str(input())

s = deque(s)

s2 = deque(s.popleft())

for i in range(n - 1):
    if s2[len(s2)-1] == s[0]:
        s.popleft()
    else:
        s2.append(s.popleft())

print(len(s2))

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

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

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

Solution (Python):
A = int(input())
slimes = input()
total = 1
for letter in range(A - 1):
  if slimes[letter] != slimes[letter + 1]:
    total += 1
print(total)

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

s = S[0]
lst = [s]
for v in S:
    if s != v:
        s = v
        lst.append(s)

print(len(lst))

Solution (Python):
n = int(input())
s = input()
ans = 0
last = '
for e in s:
    if e != last:
        ans = ans + 1
        last = e
print(ans)

Solution (Python):
import sys
import math

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):
from itertools import groupby

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

print(len(list(groupby(S))))

Solution (Python):
from collections import deque

N = int(input())
S = deque(list(input()))

cnt = N
pre = S.popleft()
while len(S) > 0:    
  if pre == S[0]:
    S.popleft()
    cnt -= 1
  else:
    pre = S.popleft()
print(cnt)

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

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):
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):
num = int(input())
slimes = list(input())

count = 0
for i in range(num-1):
  if slimes[i] == slimes[i+1]:
    count += 1

print(num - count)

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()
count = 1

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

print(count)

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

x = s[0]

s2 = s.copy()
count = 0
for num,i in enumerate(s[1:n],1):

  if x == s2[num]:


    count += 1
  x = s2[num]

print(n-count)

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


ans = ""
check = ""
for i in range(len(S)):
  if check != S[i]:
    ans += S[i]
    check = S[i]

ans = print(len(ans))

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

for i in range(N - 1):
  if (s[i] == s[i + 1]):
    s = s[:i] + '0' + s[i + 1:]

print(len(s.replace('0', '')))

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

Solution (Python):
from itertools import groupby
def print_ans(input_line):
    """Test Case
    >>> print_ans("aabbbbaaca")
    5
    >>> print_ans("aaaaa")
    1
    >>> print_ans("xxzaffeeeeddfkkkkllq")
    10
    """
    print(len(list(groupby(input_line))))

if __name__ == '__main__':
    N = int(input())
    s = input()
    print_ans(s)

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

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

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):
n = int(input())
s = list(input())

temp = ""
ans = 1

for x in s:
    if temp == "":
        temp = x
    if temp == x:
        continue
    else:
        temp = x
        ans += 1
    
print(ans)

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

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

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

latest=0
L=[]
for i in range(n):
      if s[i]!=latest:
            L.append(s[i])
            latest=s[i]
print(len(L))

Solution (Python):



sli_len = int(input())
sli_clr = list(str(input()))

sli_cnt = 1
for i in range(1, sli_len):
    if sli_clr[i] != sli_clr[i-1]:
        sli_cnt += 1

print(sli_cnt)

Solution (Python):
a = input()
a = input()

counter = 0
sub = ''
for item in a:
    if item != sub:
        counter += 1

    sub = item



print(counter)

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

Solution (Python):


N = int(input())
s = str(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 = list(input())

pred = s[0]
res = 0

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

Solution (Python):

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

lst = []
for i in S:
    if lst == []:
        lst.append(i)
    elif lst[-1] != i:
        lst.append(i)
    else:
        continue
print(len(lst))

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

l = list(s)

c_color = l[0]
slimes = []
count = 0
for item in l:
    if not item == c_color:
        slimes.append(c_color)
        count += 1
        c_color = item

slimes.append(c_color)
count += 1
c_color = item

print(count)

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

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

count = 1

previous = S[0]
for i in range(1, N):
  if previous == S[i]:
    continue
  count += 1
  previous = S[i]
  
print(count)

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

tempchar = ""
ans = n
for c in s:
	if(tempchar == c):
		ans -= 1
	else:
		tempchar = c

print(ans)

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

tempchar = s[0]
ans = n
for i in range(1, n):
	if(tempchar == s[i]):
		ans -= 1
	else:
		tempchar = s[i]

print(ans)

Solution (Python):
n = int(input())
S = input()
L = ''
cnt = 0
for i in range(n):
    if S[i]!=L:
        cnt += 1
        L = S[i]
print(cnt)

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

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

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

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

print(cnt)

Solution (Python):
n = int(input())
s = input()
ans = 1
p = s[0]

for e in s[1:]:
    if p != e:
        p = e
        ans += 1

print(ans)

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

conti = True
while conti:
    try:
        conti = False
        for count, char in enumerate(s):
            if (count - 1) >= 0 and s[count] == s[count - 1]:
                s = s[:count] + s[count + 1:]
                conti = True
    except IndexError:
        pass

print(len(s))

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()
point=1
i=0
j=0
cnt=1
while(j<len(s) and i<=j):
    if(s[j]==s[i]):
        j+=1
    else:
        cnt+=1
        i=j
print(cnt)

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

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

print(len(S))

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

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

Solution (Python):
def main():
    N = int(input())
    S = input().rstrip() + "."
    ans = sum(i != j for i, j in zip(S, S[1:]))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N = int(input())
    S = input().rstrip()
    S += "."
    ans = sum(i != j for i, j in zip(S, S[1:]))
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N = int(input())
    S = input().rstrip()
    S += "."
    ans, cur = 0, S[0]
    for s in S[1:]:
        if s != cur:
          ans += 1
          cur = s
    print(ans)


if __name__ == "__main__":
    main()

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

List_S = list(S)
Ans = 1

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

Solution (Python):
import re
input()
s=input()
print(len(re.findall(r"(.)\1*",s)))

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

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

Solution (Python):
n=int(input())
s=list(input())
result = []
for i in range(n):
  if i==0:
    result.append(s[0])
  elif s[i-1]==s[i]:
    continue
  else:
    result.append(s[i])
print(len(result))

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

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

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

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

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

Solution (Python):
n = int(input())
s = input()
stk = []
for c in s:
    while stk and stk[-1] == c:
        stk.pop()
    stk.append(c)
print(len(stk))

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

i=0
while i<(len(l)-1):
    if l[i]==l[i+1]:
        l.pop(i+1)

    else:
        i=i+1

print(len(l))

Solution (Python):
N = int(input())
line=str(input())
l=list(line)
c=0
st=[0]
for i in l:
    if st[c] != i:
        st.append(i)
        c+=1
st.remove(0)
print(len(st))

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

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

new_s = ""
temp=""

for i in range(n):
  if temp != s[i]:
    new_s += s[i]
    temp=s[i]

print(len(list(new_s)))

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

p = None
ret = 0

for si in s:
  if si != p:
    ret += 1
  p = si

print(ret)

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

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

p_c()

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

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

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

print(cnt)

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

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

tmp='0'
cnt=0
 
for i in range(N):
    if li[i]!=tmp:
        cnt+=1
        tmp=li[i]
print(cnt)

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):
n=int(input())
s=list(input())

c=0

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

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

Solution (Python):


def solve():
    N = int(input())
    S = input()

    pre_color = S[0]
    ans = 1
    for i in range(1, N):
        color = S[i]

        if pre_color == color:
            continue
        else:
            ans += 1
            pre_color = color

    print(ans)

if __name__ == "__main__":
    solve()

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):
from itertools import *

raw_input()
s = raw_input().rstrip()
print sum(1 for c, v in groupby(s))

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

Solution (Python):
n = int(input())
S = input()
tmp = ''
cnt = 0
for s in S:
    if s != tmp:
        cnt += 1
        tmp = s
print(cnt)

Solution (Python):
import math

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

char_S=list(S)

answer=1


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

print(answer)

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

count = 0
before = None
for c in S:
    if c != before:
        count += 1
    before = c

print(count)

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

Solution (Python):


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

Solution (Python):
n = int(input())
s = list(input())
if n == 1:
  print(1)
  exit()
i,j = 0,1
ans = 1
while i<j:
  if s[i]==s[j]:
    j+=1
  else:
    ans+=1
    i=j
    j+=1
  if j==n:
    break
print(ans)

Solution (Python):



n = int(input())
s = input()

ans = 0
before_s = 0
for ss in s:
    if before_s != ss:
       ans += 1
       before_s = ss
print(ans)

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

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())
count = 1

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

print(count)

Solution (Python):
import numpy as np


def main():
    N = int(input())
    S = input()
    count = 1
    now = S[0]
    for n in range(1, N):
        if(now != S[n]):
            count += 1
            now = S[n]
    print(count)


if(__name__ == "__main__"):
    main()