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):
import re;_,s=open(0);print(len(re.sub(r"(.)\1+",r"\1",s))-1)

Solution (Python):
import re;_=input();print(len(re.sub(r"(.)\1+",r"\1",input())))

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

slime = 1

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

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

Solution (Python):
import  numpy as np

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

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

Solution (Python):
N = int(input())
S = [_ for _ in input()]
ans = 0
work = ""
for s in S:
    if work == "":
        work = s
        ans += 1
        continue

    if s != work:
        ans += 1
        work = s

print(ans)

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

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):
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())
counter = 0
last_char = None
for char in S:
  if char != last_char:
    counter += 1
    last_char = char

print(counter)

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

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

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

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

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

print(c)

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

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

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

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

print(ans)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

a = list(input())

a = s(a)

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

Solution (Python):

import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: str):
    ret = 1
    for i in range(N - 1):
        if S[i] != S[i + 1]:
            ret += 1
    print(ret)
    return

def main():
    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)  
    solve(N, S)

if __name__ == '__main__':
    main()

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

S = list(str(input()))

l = 0
r = 1
t = 1
while r < N:
  if S[l] != S[r]:
    t += 1
    l = r
  else:
    l += 1
  r += 1
      
print(t)

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

ans = 0
pre = '0'
for c in s:
    if c != pre:
        ans += 1
    pre = c

print(ans)

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

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

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

Solution (Python):

def main():
    N = int(input())
    S = list(str(input()))
    St = []
    for i in range(N-1):
        if S[i]==S[i+1]:
            continue
        St.append(S[i])
    if S[N-2]==S[N-1]:
        St.append(S[N-2])
    else:
        St.append(S[N-1])
    print(len(St))

if __name__ == '__main__':
    main()

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

def main():
    N = int(input())
    s = input().strip()
    ans = 0
    pre = ""
    for i in range(N):
        if s[i] != pre:
            ans += 1
        pre = s[i]
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):


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

    Prev = '_'
    Ans = 0
    for Si in S:
        if Si != Prev:
            Ans += 1
        Prev = Si
    print(Ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
N = int(input())
S = str(input())
count = 0
S = S + '$'

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

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

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

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

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

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

cnt = 0
pre = ''
ans = N
S.append('')
for i in range(N+1):
    if S[i]==pre:
        cnt += 1
    else:
        ans-=cnt
        cnt = 0
        pre = S[i]
print(ans)

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

Solution (Python):

N = int(input())
S = str(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 = []
ans.append(s[0])

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

print(len(ans))

Solution (Python):



def main():
    n = int(input())
    s = input()
    prev = s[0]
    count = 1

    for i in range(1, n):
        cur = s[i]

        if cur != prev:
            count += 1
            prev = cur

    print(count)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
def resolve():
    n=int(input())
    s=input()
    st=set(s)
    for i in st:
        while i*2 in s:
            s=s.replace(i*2,i)
    print(len(s))
resolve()

Solution (Python):


def generator():
    for s in input():
        yield s

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

    slimes = 0
    pre_slime = None
    for s in generator():
        if s == pre_slime:
            continue
        slimes += 1
        pre_slime = s
    print(slimes) 

main()

Solution (Python):
N = int(input())
s = str(input())
l = []
for i in s:
    if not l:
        l.append(i)
    elif l[-1] != i:
        l.append(i)
print(len(l))

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

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

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

def main():
    N = int(input())
    S = input().strip()
    count = 1
    for i, v in enumerate(S):
        if i == N - 1:
            break
        if S[i] != S[i + 1]:
            count += 1

    print(count)




if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
from io import StringIO
import unittest


def input():
    return sys.stdin.readline().rstrip()


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

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


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

    def test_入力例_1(self):
        input = """10
aabbbbaaca"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """5
aaaaa"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """20
xxzaffeeeeddfkkkkllq"""
        output = """10"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()

Solution (Python):
N = int(input())
S = input()
d = S[0]

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

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

count = 1
i = 1
while i < N:
	if S[i -1] != S[i]:
		count += 1
	i += 1
	
print(count)

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

ans = 0
t = ''
for s in S:
    if s != t:
        ans += 1
        t = s
print(ans)

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

i = 0
j = 1
while j < len(a):
    if a[i] == a[j]:
        a.pop(j)
    else:
        i += 1
        j += 1

print(len(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 = input()
pas = "A"
n = 0
for c in s:
  if pas != c:
    pas = c
    n += 1
print(n)

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

ans = 0
before = ''

for s in S:
    if before != s:
        before = s
        ans += 1

print(ans)

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

a = ""
ans = 0
for s in sentense:
  if a != s:
    ans += 1
    a = s
print(ans)

Solution (Python):
'''C - Slimes
https://atcoder.jp/contests/abc143/tasks/abc143_c

>>> main(10, 'aabbbbaaca')
5
>>> main(5, 'aaaaa')
1
>>> main(20, 'xxzaffeeeeddfkkkkllq')
10

'''


def main(n, s):
    i = 0
    tmp = ''

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

        tmp = s

    print(i)


if __name__ == "__main__":
    n = int(input())
    s = input()

    main(n, s)

Solution (Python):
from sys import exit, stdin
N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()
ans = 1
tmp_s = S[0]
for s in S[1:]:
    if tmp_s != s:
        ans += 1
        tmp_s = s
print(ans)

Solution (Python):
from itertools import groupby

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

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

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


def main():
    N = int(input())
    S = input()
    ans = 1
    flg = False
    for i in range(N-1):
        if S[i] == S[i+1] and not flg:
            flg = True
        elif S[i] != S[i+1]:
            flg = False
            ans += 1
    print(ans)


if __name__ == '__main__': main()

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

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

print(len(after))

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

result = 1

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

Solution (Python):
N = int(input())
S =list(input())
c=1
for i in range(N-1):
    if S[i]!=S[i+1]:
        c+=1
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=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()
prev = s[0]
count = 1
for c in s[1:]:
  if prev == c:
    prev =c
  else:
    count+= 1
    prev =c

print(count)

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

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

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

last_s = ""
for s in S:
    if s is not last_s:
        new_S += s
    last_s = s
print(len(new_S))

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

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

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

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

Solution (Python):


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

Solution (Python):
n = input()
s = raw_input()
pre = 'A'
count = 0
for char in s:
  if char!=pre:
    count+=1
    pre=char
print count

Solution (Python):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string



def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')



input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
s=StoI()
ans=0

for i in groupby(s):
    ans+=1
print(ans)

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

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

print(len(ans))

Solution (Python):
def main():
    baselist=[]
    anslist=[]
    N = input()
    baseword = input().rstrip()
    [baselist.append(i) for i in baseword]
    for index,value in enumerate(baselist):
        if int(index+1)<int(len(baselist)):
            if baselist[index]!=baselist[index+1]:
                anslist.append(baselist[index])
        else:
            anslist.append(baselist[index])
    print(len(anslist))

if __name__ == "__main__":
    main()

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

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

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

crt = ''
res = 0
for i in range(n):
    a = s[i]
    if a != crt:
        res += 1
    crt = a
print(res)

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

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

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

count = []

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

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):
def solve():
    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__':
    solve()

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()
ans = 0
idx = 0
while idx < n:
  sub = 0
  while idx + sub < n and s[idx] == s[idx + sub]:
    sub += 1
  ans += 1
  idx += sub
print(ans)

Solution (Python):
from itertools import groupby

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

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

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

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

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

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

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

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=list(input())
t=n
for c in range(n-1):
    if s[c]==s[c+1]:
        t=t-1
print(t)

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

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

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

count = 1
result = []
for i in range(N) :
  if i == 0 :
    before = S[i]
    continue
  if before == S[i] :
    count += 1
  else :
    result.append(count)
    count = 1
    before = S[i]

result.append(count)
print(len(result))

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

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



s=list(input())
s.append("?")
ans=0
for i in range(n):
    if s[i]!=s[i+1]:
        ans+=1
print(ans)

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

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

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

stack = []
for s in S:
    if stack == [] or stack[-1] != s:
        stack.append(s)

print(len(stack))

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

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

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

Solution (Python):
import re
count = input()
string = input()
result = 1
for num_word in range(0, len(string) - 1):
    if string[num_word] != string[num_word + 1]:
        result += 1
print(result)

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

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

Solution (Python):

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

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

a = 1

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

Solution (Python):



if __name__ == "__main__":
  n = int(input())
  vals = list(input())
  
  res=1
  prev = vals[0]
  for idx, val in enumerate(vals[1:]):
    if val == prev:
      continue
    else:
      prev = val
      res += 1

  print(res)

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

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

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

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

print(cnt)

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

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

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

print(sum(1 for a, b in zip('_' + S, S) if a != b))

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

    
    
    
    

    ans = 0

    
    for i in range(n-1):
        if s[i] != s[i + 1]:
            ans += 1
    print(ans + 1)
    
if __name__ == '__main__':
    answer_143c()

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

ans = [1]
now_s = S[0]
for i in range(1, N):
    if now_s == S[i]:
        ans[-1] += 1
    else:
        ans.append(1)
    now_s = S[i]

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

Solution (Python):
def main():
    N, S = open(0).read().split()
    print(sum(1 for x, y in zip(S[:], S[1:]) if x != y) + 1)
    return


main()

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    s = S()
    r = 0
    t = '-'
    for c in s:
        if c != t:
            r += 1
            t = c

    return r


print(main())

Solution (Python):
def main():

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

class Solution(object):
    def __init__(self):
        self.n = int(sys.stdin.readline())
        self.colors = sys.stdin.readline()

    def get_combined_slimes(self):
        count = 1
        curr_color = self.colors[0]
        for i in range(1, len(self.colors)-1):
            if curr_color != self.colors[i]:
                
                
                curr_color = self.colors[i]
                count += 1
        return count

if __name__ == "__main__":
    s = Solution()
    print(s.get_combined_slimes())

Solution (Python):
n = int(input())
s = [str(i) for i in input()]
tmp = "0"
st = []

for i in range(n):
    if s[i] == tmp:
        pass
    else:
        st.append(s[i])
        tmp = s[i]

print(len(st))

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(str(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()
ans = 1
now = S[0]
for i in range(1,N):
    if now == S[i]:
        pass
    else:
        ans += 1
        now = S[i]
print(ans)

Solution (Python):
import sys

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

slime = 0
current = ''

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

print(slime)

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

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    input()
    s=input()
    from itertools import groupby
    print(len(list(groupby(s))))
resolve()

Solution (Python):
from math import *
from copy import *
from string import *				
from random import *
from sys import stdin
from sys import maxsize
from operator import *				
from itertools import *
from collections import Counter		

def pow(a,b):
	if(b==0):
		return 1
	else:
		val=pow(a,int(b/2))
		if(b%2==0):
			return val*val
		else:
			if(b>0):
				return a*val*val
			else:
				return (val*val)//a

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

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):
a = 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())
text=input()
x=1
for i in range(N-1):
  if text[i]!=text[i+1]:
    x+=1
print(x)

Solution (Python):
n=int(input())
l=list(input())
now=l[0]
count=0
for i in range(1,n):
  if now!=l[i]:
    count+=1
    now=l[i]
  else:
    pass
print(count+1)

Solution (Python):


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

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

Solution (Python):

from itertools import groupby


def main():
    N = int(input())
    S = input().rstrip()
    ans = len(list(groupby(S)))
    print(ans)


if __name__ == "__main__":
    main()

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

prev = None
count = 0

for i in S:
  if prev != i:
    prev = i
    count += 1
    
print(count)

Solution (Python):
n = int(input())
s = input()
def get_sequence(arr):
  if len(arr) == 0:
    return [], []
  elements = []
  nums = []
  n = 1
  prev = arr[0]
  for c in arr[1:]:
    if c == prev:
      n += 1
    else:
      elements.append(prev)
      nums.append(n)
      prev = c
      n = 1
  elements.append(prev)
  nums.append(n)
  return elements, nums
print(len(get_sequence(s)[0]))

Solution (Python):

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

Solution (Python):
def c_slimes():
    from itertools import groupby
    N = int(input())
    S = input()
    return len([k for k, v in groupby(S)])

print(c_slimes())

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

Solution (Python):
a = int(input())
b = input()
s = 1
for i,j in zip(b,b[1:]):
    if i != j :s+=1
print(s)

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

Solution (Python):
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline


N = int(input())




S = input().strip()

c = ""
ans = []
for i in range(len(S)):
    if c == "":
        c = S[i]
        ans.append(c)
    else:
        if ans[-1] != S[i]:
            ans.append(S[i])

print(len(ans))

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 = 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 = list(input())
ans =1
now_number =0

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

Solution (Python):
n = int(input())
s = str(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 = input()
ans, pre = 0, "*"
for s in S:
    if s != pre:
        ans += 1
    pre = s

print(ans)

Solution (Python):
from sys import stdin
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())

n = int(input())
s = input().strip('\n')
ans = 0
for i in range(1, n):
    if s[i] != s[i-1]:
        ans += 1
print(ans+1)

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

count=0
while True:
    try:
        if S[count]==S[count+1]:S.pop(count)
        else:count+=1
    except:break
print(len(S))

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

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()
prev = ""
ans = 0

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

    prev = S[i]

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

result = []

for i in range(int(n)):
    if s[i:i + 1] != s[i + 1:i + 2]:
        result.append(s[i:i + 1])

print(len(result))

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

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