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

if n == 1:
    print(1)
else:
    ss = []

    for i in range(1, n):
        
        if s[i] != s[i-1]:
            ss.append(s[i])

    print(1+len(ss))

Solution (Python):
N = int(input())
S = str(input())
prevcolor = ""
ct = 0
for s in S:
    if s != prevcolor:
        ct+=1
        prevcolor=s

print(ct)

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

Solution (Python):
N=[int(x)for x in input().split()]
D=[x for x in list(input())]

total=1

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

print(total)

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

Solution (Python):
def Slimes(N, S):
    after = S[0]
    for i in range(1, N):
        if S[i] != after[-1]:
            after += S[i]
    return len(after)

N = int(input())
S = str(input())
print(Slimes(N, S))

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

ans = []
bef_color = ""
for s in S:
	if bef_color != s:
		bef_color = s
		ans.append(s)

print(len(ans))

Solution (Python):
slime_num = int(input())
slime_color = input()
color_list = []
for slime in slime_color:
    color_list.append(slime)
for slime in range(slime_num):
    if slime == slime_num - 1:
        break
    if color_list[slime]  == color_list[slime + 1]:
        color_list[slime] = ""
slime_color_ans = ""
for color in color_list:
    if color != "":
        slime_color_ans += color
print(len(slime_color_ans))

Solution (Python):

n = int(input())
s = input()
now = ' '
conter = 0
for i in s:
  if now != i:
    now = i
    conter += 1
print(conter)

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

Solution (Python):
n = int(input())
s = str(input())
ans = 1
a = s[0]
for i in range(1, n):
    if s[i] == a: continue
    else:
        ans += 1
        a = s[i]
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())
s = input()
cnt=1
for i in range(n-1):
    if s[i] != s[i+1]:
        cnt+=1

print(cnt)

Solution (Python):
a = int(input())
s = input()
k = "A"
r = ""
for c in s:
    if c != k:
        r += c
    k = c

print(len(r))

Solution (Python):
from collections import deque

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

new_s = []
flag = True
while flag:

    if len(S) == 1:
        new_s = [1]
        break

    new_s = []
    flag = False
    for i in range(len(S)-1):
        current_char = S[i]

        if current_char == S[i+1]:
            flag = True
            continue
            
        else:
            new_s.append(current_char)

    new_s.append(S[-1])
    S = new_s



print(len(new_s))

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

r = [True]

r.extend([s[i-1] != s[i] for i in list(range(1,len(s)))])
print(sum(r))

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):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from itertools import permutations, combinations,combinations_with_replacement,product
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys


setrecursionlimit(1000000)

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

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

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

    print(ans if ans !=0 else 1)
main()

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

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

Solution (Python):
n = int(input())
prev, cnt = '', 0
for c in input():
    if c != prev: cnt += 1
    prev = c
print(cnt)

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

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

d = [0] * n
res = ""
for i in range(n):
    if(d[i] == 1):
        continue
    for j in range(1, n-i):
        if s[i] == s[i+j]:
            d[i+j] = 1
        else:
            break

    res += s[i]

print(len(res))

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


print(len(list))

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

cnt = 0
old = '*'
for i in range(len(s)):
    if s[i] != old:
        cnt += 1
        old = s[i]

print(cnt)

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

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

r = [S[0]]

for i in range(1, N):
    if S[i] != S[i-1]:
        r.append(S[i])

print(len(r))

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

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

Solution (Python):


''' 
------------------------
author : iiou16
------------------------
'''

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

_ = int(input())
S = input()
s = deque([i for i in S])

count = 1
last = s.popleft()
for i in range(_-1):
    poped = s.popleft()
    if last == poped:
        continue
    else:
        count += 1
        last = poped
print(count)

Solution (Python):
from itertools import zip_longest
n = int(input())
s = input()
test_list = list(s)
res = [i for i, j in zip_longest(test_list, test_list[1:]) if i != j]
print(len(res))

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

Solution (Python):
N = int(input())
M = list(input())
oi =1
m = M[0]
for i in range(1,len(M)):
    if m == M[i]:
      pass
    else:
      m = M[i]
      oi = oi + 1    
    
print(oi)

Solution (Python):
n = int(input())
S = input()
buff = ''
ans = []
for s in S:
    if s != buff:
        ans.append(s)
        buff = s
print(len(ans))

Solution (Python):


import sys

n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()

cnt = 0
prev=""
for c in s:
    if c==prev: continue
    cnt += 1
    prev = c

print(cnt)

Solution (Python):
n=int(input())
s=input()
ans=str()
for i in range(n-1):
	if not s[i]==s[i+1]:
		ans+=s[i]
if n>=2:
	ans+=s[n-1]
elif len(ans)==0:
	ans='1'
print(len(ans))

Solution (Python):
from itertools import groupby

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

print(sum(1 for k, _ in groupby(S)))

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

result = 1
prev = S[0]
for c in S[1:]:
    if prev != c:
        result += 1
    prev = c

print(result)

Solution (Python):
N = int(input())
d = [x for x in input()]


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

Solution (Python):
N = int(input())
S = input()
import re
def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))  
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]

print(len(list(nchars(S, 1))))

Solution (Python):
n = int(input())
s = list(map(str, input()))
same = 0
for i in range(1,n):
    if s[i] == s[i-1]:
        same += 1
    else:
        continue

print(n-same)

Solution (Python):
n = int(input())
s = input()
ans = [s[0]]
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        pass
    else:
        ans.append(s[i+1])
        
print(len(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):
n = int(input())
s = input()
b = ''
c = 0
for i in s:
  if b == i:
    b = i
    pass
  else:
    c += 1
    b = i
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())
sum = 1

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

print(sum)

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

count = 0

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

print(len(s) - count)

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


if __name__ == "__main__":
    Input = [input() for i in range(2)]
    N = int(Input[0])
    
    S = str(Input[1])
    c = 1
    for i in range(1,N):
        if S[i] != S[i-1]:
            c += 1
        else:
            pass
    print(c)

Solution (Python):
def A():
    temp = [int(i) for i in input().split()]
    print(max(0, temp[0]-2*temp[1]))

def B():
    N = int(input())
    T = [int(i) for i in input().split()]
    s = 0
    for i in range(N):
        for j in range(i):
            s += T[i]*T[j]
    print(s)

def C():
    N = int(input())
    S = input()
    if N == 1:
        print(1)
    else:
        ans = 1
        cur_c = S[0]
        for c in S:
            if c != cur_c:
                ans += 1
                cur_c = c
        
        print(ans)

C()

Solution (Python):
N=int(input())
S=input()
ans=S[0]
X=S[0]
for i in range(1,N) :
    if S[i] == X :
        pass
    else :
        ans = ans + S[i]
        X=S[i]
print(len(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):
n = int(input())

ls = input()
vocab = set(list(ls))

for v in vocab:
    vv = True
    while vv:
        if v+v in ls:
            ls = ls.replace(v+v, v)
        else:
            vv = False

print(len(ls))

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

ans = 0
n = 1

while n<N:
  if S[n]==S[n-1]:
    ans +=1
    n +=1
  else:
    n+=1

print(N-ans)

Solution (Python):
N = input()
S = list(input())
ans = 1
hako = S[0]

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

Solution (Python):
"""
N=int(input())
L=[int(x) for x in input().split()]
L.sort()
count=0


for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            if L[k]>=L[i]+L[j]:
                break
            count+=1
            
print(count)
"""
N=int(input())
S=input()
result=N
for i in range(N):
    if i+1==N:
        break
    
    if S[i]==S[i+1]:
        result-=1

print(result)

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

flag=True


while(flag):
  flag=False
  c_new=''
  for i in range(len(c)-1):
    if c[i]==c[i+1]:
      flag=True
      
      
    else:
      c_new+=c[i]
  c_new+=c[len(c)-1]
  c=c_new
print(len(c))

Solution (Python):
n=int(input())
s=input()
from itertools import*
g=[len(list(v))for k,v in groupby(s)]
print(len(g))

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

N = int(readline())
S = readline()

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

Solution (Python):
n = int(input())
s = input()
dict = {}
for i,j in zip(range(0, n), s):
    dict[i] = j

for i in range(0, n - 1):
    if dict[i] == dict[i+1]:
        del dict[i]
        n -= 1
    else:
        continue
print(len(dict))

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

i = 0
while len(s) - 1 >= i + 1:
    while s[i] == s[i + 1]:
        s.pop(i)
        if i + 2 > len(s):
            break
    i += 1
        
print(len(s))

Solution (Python):
def main():
    N = int(input())
    S = input()
    prev = "-"
    res = 0
    for c in S:
        if prev != c:
            res += 1
            prev = c
    print(res)
main()

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

Solution (Python):
import sys

n = int(sys.stdin.readline())
S = list(sys.stdin.readline().rstrip())

for i in range(1, n):
    if(S[i-1] ==S[i]):
        S[i-1]=""
S = ''.join(S)

print(len(S))

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

answer = list()
dp = S[0]

answer.append(S[0])
for i, s in enumerate(S):
  if(dp != s):
    answer.append(s)
    dp = s
    
    
print(len(answer))

Solution (Python):
def calc(N, S):
    r = 0
    c = ''
    for i in range(N):
        if c != S[i]:
            r += 1
            c = S[i]
    return r


N = int(input())
S = input()
print(calc(N, S))

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

counter = 1

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

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

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

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

ans = 1
i = 0
j = 0
while i < (N-1):
  j += 1
  while S[i] == S[j]:
    if j == N-1: 
      print(ans)
      exit()
    else:
      j += 1
  ans += 1
  i = j
  
print(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):
import itertools

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


def solve():
    cnt = 0
    for key in itertools.groupby(S):
        cnt += 1

    return cnt


print(solve())

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

r = ds[0]
for d in ds[1:]:
  if r[-1] != d:
    r += d

print(len(r))

Solution (Python):
_ = input()
S = input()
k = 1
for b, a in zip(S[:-1], S[1:]):
    if b!=a:
        k += 1
print(k)

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

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

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

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

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

print(len(s)-count)

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

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

print(N - count)

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

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


c = len(arr)
print(c)

Solution (Python):
n=int(input())
a=input()
i=0
b=[a[0]]
j=0
p=0
while(i<len(a)):
    if(b[-1]!=a[i]):
        b.append(a[i])
    i=i+1
print(len(b))

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

last = []

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

print(len(last))

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

a=""
result=0
for s in S:
    if a!=s:
        result +=1
    a=s

print(result)

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

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

Solution (Python):
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


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


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    A, B = LI()
    ans = A-2*B
    if ans > 0:
        print(ans)
    else:
        print(0)
    return




def B():
    N = II()
    d = LI()
    ans = 0
    for i in range(N):
        for x in range(i+1, N):
            ans += d[i]*d[x]
    print(ans)

    return




def C():
    N = II()
    S = input()
    c=0
    count=0
    for i in S:
        if i!=c:
            count+=1
        c=i
    print(count-1)

    return




def D():
    A, B = map(int, input().split())
    g = gcd(A, B)
    
    
    sq = int(sqrt(g)) + 2
    ans = 1

    for i in range(2, sq):
        if g % i == 0:
            ans += 1
        while g % i == 0:
            g /= i

            
        if g == 1:
            break
        if i == sq - 1:
            
            ans += 1

    print(ans)

    return




def E():
    N, M = LI()
    bit_max = 1 << N
    dp = [[inf for i in range(bit_max)] for j in range(M+1)]
    dp[0][0] = 0

    for i in range(M):
        a, b = LI()

        c = LI()
        bit = 0

        for d in c:
            bit |= 1 << (d-1)

        for w in range(bit_max):

            t = w | bit
            cost = dp[i][w] + a

            dp[i+1][t] = min(dp[i+1][t], cost)

            dp[i+1][w] = min(dp[i][w], dp[i+1][w])

    print(-1) if dp[-1][-1] == inf else print(dp[-1][-1])

    return




def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    



def solution(S):
    
    import math

    vowels = "AIUEO"
    count = 0
    consonants = 0
    newC = []
    newV = []

    for i in S[:-1]:
        if i in vowels:
            count += 1
            newV.append(i)
        else:
            consonants += 1
            newC.append(i)

    if consonants < count or consonants - 2 > count:
        return 0

    a = math.factorial(len(set(newC))) * math.factorial(len(set(newV)))
    return a

    pass



if __name__ == '__main__':
    C()

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

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

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

res = 0
before = None
for a in s:
  if a != before:
    res += 1 
  before = a

print(res)

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

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

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

print(n - count)

Solution (Python):

N = int(input())

S = input()

ans = 1

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

print(ans)

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

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

count = 0
mem = str()
for s in S:
    if mem == s:
        continue
    else:
        count += 1
        mem = s

print(count)

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

Solution (Python):
N = int(input())
S = input()
seen = []
tot = N
for char in S:
    if not seen:
        seen.append(char)
    elif char == seen[-1]:
        tot -= 1
        seen.append(char)
    else:
        seen.append(char)
print(tot)

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

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

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

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

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



c_list_org = c_list

for c in range(len(c_list_org)):
    
    if c >= len(c_list)-1:
        break
    if c_list[c] == c_list[c+1]:
        c_list[c] = "del"


c_list = [c for c in c_list if c != "del"]

print(len(c_list))

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

Solution (Python):
N = int(input())
S = list(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()+'Q'
c = 0
for k in range(N):
	if S[k] != S[k+1]:
		c += 1
print(c)

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

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

print(cnt)

Solution (Python):
N=int(input())
S=list(input())
ret=0
s_pre=""


for s in S:
  
  if s_pre!=s:
    ret+=1
  s_pre=s
print(ret)

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

color = []
for i in range(len(S)):
    color.append(S[i])
lst = []

for i in range(N-1,-1,-1):
    if i<=N-2:
        if color[i+1]==color[i]:
            color.pop(i+1)


print(len(color))

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

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

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

print(len(compressed))

Solution (Python):
n = int(input())
s = input()
i = 0
c = s[0]
ans = 1
while True:
  if c != s[i]:
    ans += 1
    c = s[i]
  i += 1
  if i == n:
    break 
print(ans)

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

out = '0'

for i in s:
    if out[-1] != i:
        out += i

print(len(out) - 1)

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

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

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

Solution (Python):
import numpy as np

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

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

print(cnt)

Solution (Python):
import itertools
n=int(input())
s=list(input())
a=[]
for i in itertools.groupby(s):
    a.append(i)
print(len(a))

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

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

result = 0
pre = None

for x in S:
    if pre is None or pre != x:
        result += 1
    pre = x

print(result)

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


count=1

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

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

checkS = ''
result = 0

for i in s:

   if checkS != i:
      result += 1
   
   checkS = i

print(str(result))

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

c=list()

c.append(s[0])

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

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


while True:
    temp_s = []
    prev_color = ""
    isFusion = False
    for i in range(len(s)):
        if s[i] == prev_color:
            continue
        else:
            temp_s.append(s[i])
            prev_color = s[i]
    s = temp_s
    if not isFusion:
        break
print(len(s))

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

    count = 1
    prev = s[0]

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

    print(count)


if __name__ == '__main__':
    c()

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

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

print(count)

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

l = len(S)

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

print(l)

Solution (Python):
import re

def C():
    n = input()
    s = input()
    ss = re.sub(r"(.)\1{1,}",r"\1",s)
    print(len(ss))

if __name__ == '__main__':
    C()

Solution (Python):

from sys import stdin

n = int(stdin.readline().rstrip())
s = str(stdin.readline().rstrip())
a = 1
ans = s[0]
while a < n:
    if s[a-1] == s[a]:
        pass
        a += 1
    else:
        ans += s[a]
        a += 1

print(len(ans))

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

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

Solution (Python):
N=int(input())
S=list(input())
s=S.copy()
n=0
for i in range(N-1):
  if S[i]==S[i+1]:
    del s[i+1-n]
    n+=1
print(len(s))

Solution (Python):
N = int(input())
S = str(input())
flag = False
count = 1
for a in range(len(S)-1):
    if S[a] == S[a+1]:
        flag = True
    else:
        flag = False
    
    if flag == False:
        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 = ans+1
print(ans+1)

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

Solution (Python):
n = int(input())
s = input()
c = [0] * len(s)
o = s[0]
ans = []
for i in range(1, len(s)):
    if s[i] == o:
        c[i] = 1
    else:
        o = s[i]
for i in range(len(s)):
    if c[i] == 0:
        ans.append(s[i])
print(len("".join(ans)))

Solution (Python):
n = int(input())
s = str(input())
count = 1
for i in range(n):
    try:
        if s[i] != s[i+1]:
            count += 1
    except IndexError:
        break
print(count)

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

print(len(a))

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

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

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

print(count)

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

Solution (Python):
n = int(input())
s = list(input())
ans = []

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

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

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

Solution (Python):
N = int(input())
S = input()
ans = [S[0]]
for i in range(1, N):
  if S[i] != ans[-1]:
    ans.append(S[i])
  else:
    continue
print(len(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())
slimes = input()

temp = None
count = 0

for slime in slimes:
  if slime != temp:
    count += 1
  temp = slime

print(count)

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

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

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

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

num = 1
for i in range(1,N):
	if i == 0:
		color.append(S[0])
	else:
		if S[i] == S[i-1]:
			continue
		else:
			num +=1
print(num)

Solution (Python):

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

before = ""
cnt = 0
for s in S:
    if s == before:
        pass
    else:
        cnt += 1
    before = s

print(cnt)

Solution (Python):



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


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


print(ans + 1)

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=list(str(input()))
t=[s[0]]
for i in range(n-1):
    if s[i] == s[i+1]:
        pass
    else:
        t.append(s[i+1])
print(len(t))