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

mae = S[0]
ans = 1

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

print(ans)

Solution (Python):
import sys

def solve(n, s):
    pre = ""
    ans = n
    for s_i in s:
        if s_i == pre:
            ans -= 1
        pre = s_i

    print(ans)

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    s = sys.stdin.readline().strip()
    solve(n, s)

Solution (Python):
n = int(input())
s = input()
a = ""
mae = ""
for i in s:
    if(mae != i):
        mae = i
        a = a + i
print(len(a))

Solution (Python):
N = int(input())
S = input()
ans = 0
f = ''
for i in S:
    if i != f:
        f = i
        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()

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

ans = 1

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

print(int(ans))

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

res = 0
i = 0
while i < N:
    j = 1
    while i + j < N and S[i] == S[i + j]:
        j += 1
    i += j
    res += 1
print(res)

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 + sum([True if i != j else False for i, j in zip(s[:-1], s[1:])])
print(a)

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

tmp = ''
ans = ''
for i, val in enumerate(S):
    if i != 0:
        if tmp != val:
            ans += val
        tmp = val
    else:
        tmp = val
        ans += val
print(len(ans))

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

Solution (Python):

from itertools import groupby

N = int(input())
S = input()
L = []

for i in range(N):
  L.append(S[i])

sum = 0
for key, value in groupby(L):
    sum += 1
print(sum)

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

Solution (Python):

n = int(input())
s = input()
result = 0
cont_col = ""
for si in s:
    if cont_col != si:
        result += 1
        cont_col = si
print(result)

Solution (Python):

import sys
from collections import deque
args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False
input = sys.stdin.readline
N = int(input())
Ss = list(input())
if em: sys.stdin = open('/dev/tty')
ans = []
for S in Ss:
  if ans == []:
    ans.append(S)
  elif ans[-1] == S or S == '\n':
    continue
  else:
    ans.append(S)
print(len(ans))

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

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

    ans = 0
    previous_s = ''
    for s in string:
        if s != previous_s:
            ans += 1
        previous_s = s
    print(ans)


if __name__ == '__main__':
    main()

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

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

counter = 1

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

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

slist = []
mys = S[0]

for i in range(1,len(S)):
    if mys != S[i]:
        slist += [mys]
        mys = S[i]
    else:
        continue
    
print(len(slist) + 1)

Solution (Python):
import sys


input = sys.stdin.readline


def main():
    n = int(input())
    s = input().strip()
    hoge = 1
    prev = s[0]
    for i in s[1:]:
        if prev == i:
            continue
        hoge += 1
        prev = i
    print(hoge)


if __name__ == "__main__":
    main()

Solution (Python):

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

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

print(ans)

Solution (Python):

from math import sqrt
import sys
from collections import defaultdict

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

N = int(input())
S = input()
x = "*"
ans = 0
for s in S:
    if s != x:
        ans += 1
        x = s
print(ans)

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

Solution (Python):
import glob




REL_PATH = 'ABC\\143\\C'


TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]

        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class C(Common):

    def resolve(self):
        N = int(self.input_data())
        S = self.input_data()

        slimes = list(S)

        tmp = ""
        result = 0

        for slime in slimes:
            if tmp == slime:
                continue
            else:
                result += 1
                tmp = slime

        print(str(result))

solver = C(REL_PATH)
solver.exec_resolve()

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

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

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

print(ans)

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

print(num)

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

Solution (Python):
n = int(input())
s = input()
ns = ''
pre = ''
for i in s:
    if i!=pre:
        ns += i
    pre = i
print(len(ns))

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

cnt=1
a = S[0]
for s in S[1:]:
  if s != a:
    cnt += 1
  a = s

print(cnt)

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

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

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

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

Solution (Python):
n = int(input())
s_list = list(input())
temp_sum = 0
prev_s = s_list[0]
for i in range(1,n):
    if s_list[i] == s_list[i-1]:
        temp_sum += 1
print(n-temp_sum)

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

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

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

Solution (Python):
N = int(input())
s = list(input())
now = "!"
sum_ = 0
for i in range(N):
    if now != s[i]:
        sum_ += 1
        now = s[i]
print(sum_)

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

Solution (Python):
n = int(input())
s = input()
a = []
ps = ""
for _s in s:
    if ps != _s:
        a.append(_s)
        ps = _s
print(len(a))

Solution (Python):
from itertools import groupby

input()
print(sum(1 for _ in groupby(input())))

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

count = 1
s = S[0]

i = 1
while i < len(S):
    if s != S[i]:
        count += 1
        s = S[i]
    i += 1

print(count)

Solution (Python):
def solve():
    n = int(input())
    s = list(input())
    l = n+0
    while True:
        for i in range(l-1)[::-1]:
            if s[i] == s[i+1]:
                s.pop(i)
                l-=1
        if n == l:
            break
        n = l
    print(l)

if __name__ == '__main__':
    solve()

Solution (Python):

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

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

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

print(ans)

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

prev = ' '
ans = 0
for c in S:
    if c != prev:
       ans += 1
       prev = c
print(ans)

Solution (Python):
N = int(input())
S = str(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
if N > 1:
  for i in range(N - 1):
    if S[i] != S[i + 1]:
      ans += 1
print(ans)

Solution (Python):
input()
s = input()
if len(s) == 1:
    print(1)
else:
    ans = len(s)
    cur_char = s[0]
    cur_counter = 1
    for char in s[1:]:
        if cur_char == char:
            cur_counter +=1
        else:
            ans -= cur_counter -1 
            cur_char = char
            cur_counter = 1
    ans -= cur_counter -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=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()
S=list(S)

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

Solution (Python):


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

    lastC = None
    n = 0

    for c in S:
        if lastC != c:
            lastC = c
            n += 1

    print(n)
    


if __name__ == '__main__':
    main()

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

Solution (Python):
n = int(input())
s = input()
before = ''
new = ''
for c in s:
    if before != c:
        new += c
        before = c
print(len(new))

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

Solution (Python):
n = int(input())
char_list = list(input())
result_list = []

count = 0
pre_char = ''
for target in char_list:
    if (target != pre_char):
        count += 1
        pre_char = target

print(count)

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

print(count)

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

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

after = []
last = "zz"
for v in c:
    if v != last:
        after.append(v)
    last = v

print(len(after) )

Solution (Python):
def main():
    n=int(input())
    c=input()
    ans = 0
    tmp=c[0]
    for i in c[1:]:
        if tmp != i:
            ans += 1
            tmp = i
    if tmp == c[-1]:
        print(ans+1)
    else:
        print(ans)
if __name__ == '__main__':
    main()

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


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

Solution (Python):
input()
s = input()
res = 0
before = None
for c in s:
  if (c == before):
    pass
  else:
    res += 1
  before = c
print(res)

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

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

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

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

print(cnt)

Solution (Python):
n = int(input())
S = input()
ans =1
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(n-1) :
    if not s[i] == s[i+1] :
        c += 1

print(c)

Solution (Python):

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

print(count)

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

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

print(sum)

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

Solution (Python):

import sys
import math
import numpy as np
import itertools


n = int(input())


m = list(input())
answer = n
for i in range(1,n):
    if m[i-1]==m[i]:
        answer -= 1

print(answer)

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

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

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

Solution (Python):
N = int(input())
S = list(input())
ans = 0
print(sum(a != b for a, b in zip(S, S[1:])) + 1)

Solution (Python):

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

res=[]
tmp=""
for i in range(N):
    if i==0:
        tmp=S[0]
        res.append(S[0])
    else:
        if(tmp==S[i]):
            continue
        else:
            tmp=S[i]
            res.append(S[i])

print(len(res))

Solution (Python):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
input = sys.stdin.readline

setrecursionlimit(1000000)

dp = defaultdict(lambda x:-1)

def main():
	n = int(input())
	s = input()
	print(len(zip(s)) - 1)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

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

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

print(ans)

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

count = 1
b = s[0]
for i in range(1, n):
  if s[i] == b:
    continue
  else:
    count += 1
    b = s[i]
print(count)

Solution (Python):
N = int(input())
S = list(input())
tmpList = [S[0]]
ans = 1
for char in S:
    if tmpList[-1] == char:
        continue
    tmpList.append(char)
    ans+=1
print(ans)

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

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

print(ans)

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

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

Solution (Python):
N=int(input())
S=str(input())
c=1
i=0
while i <=N-2:
  if S[i]==S[i+1]:
    i=i+1
  else:
    c=c+1
    i=i+1
print(c)

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


pattern = "a+|b+|c+|d+|e+|f+|g+|h+|i+|j+|k+|l+|m+|n+|o+|p+|q+|r+|s+|t+|u+|v+|w+|x+|y+|z+"
result = re.finditer(pattern, s)

count=0
for res in result:
  count+=1

print(count)

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

ret = 0

old = ""
for s in S:
  if s != old:
    ret += 1
    old = s

print(ret)

Solution (Python):
from itertools import groupby

input()
print(sum(map(bool, groupby(input()))))

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
S = (stdin.readline().rstrip()) + "@"
cnt = 1
ans = N
for i in range(0,N):
    if S[i] == S[i+1]:
        cnt += 1
    else:
        if cnt != 1:
            ans -= (cnt-1)
        cnt = 1
print(ans)

Solution (Python):
n=int(input())
s=list(input())
ans=0;d=""
for i in s:
  if i==d:
    continue
  else:ans+=1;d=i
print(ans)

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

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

cnt += 1

print(cnt)

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

ans = 1
_x = S[0]
for x in S[1:]:
    if _x == x:
        pass
    else:
        ans += 1
        _x = x

print(ans)

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

if N==1:
    print(1)
    exit()

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

print(cnt+1)

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

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

num = 1

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

print num

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

ans=1

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

print(ans)

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

c = 0
p = ''
for s in S:
    if p != s:
        c += 1
    p = s

print(c)

Solution (Python):
n = int(input())
s = input()
tmp = ""
answer = 0

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

print(answer)

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

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    s = input()
    bf = ""
    af = ""
    for i in s:
        if bf =="":
            bf = i
            af = i
        else:
            if i != bf:
                af = af +i
                bf = i
    print(len(af))

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

Solution (Python):
import sys


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

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

    print(ans)


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys


def solve(N: int, S: str):
    prev =S[0]
    answer = 1
    for ss in S:
        if ss != prev:
            answer += 1
        prev = ss
    print(answer)
    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):
import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)




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

    pre = ''
    ans = 0

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

        pre = s

    print(ans)


if __name__ == '__main__':
    main()

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

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

print(c)

Solution (Python):






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





mae = ''
ans = 0
for s in S :
    if s == mae :
       pass
    else :
        ans += 1
    mae = s
print(ans)

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

i = 0
while i < n-1:
	if s[i] == s[i+1]:
		s = s[:i+1] + s[i+2:]
		n -= 1
	else:
		i += 1
print(len(s))

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

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

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

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

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

print(X)

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

ans = 1

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

print(ans)

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

Solution (Python):
num = int(input())
slime = list(input())
p = num
for i in range(num-1):
  if slime[i] == slime[i+1]:
    p -= 1
print(p)

Solution (Python):
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations
from random import random

import numpy as np

sys.setrecursionlimit(200000)


class Solver:
    def __init__(self):
        pass

    def input(self):
        """
            faster input function than builtin stdin.
        """
        return sys.stdin.readline()[:-1]

    def ii(self, t: type = int):
        """
            input single value.
        """
        return t(self.input())

    def il(self, t: type = int):
        """
            input single line.
        """
        return list(map(t, self.input().split()))

    def imi(self, N: int, t: type = int):
        return [self.ii(t) for _ in range(N)]

    def iml(self, N: int, t: type = int):
        return [self.il(t) for _ in range(N)]

    def solve(self):
        N = self.ii()
        S = self.ii(t=str)
        current = S[0]
        ans = S[0]
        for s in S[1:]:
            if current == s:
                continue
            ans += s
            current = s
        return len(ans)


if __name__ == "__main__":
    solver = Solver()
    print(solver.solve())

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

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


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

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

    targets = input()
    ans = 1

    for i in range(len(targets)-1):
        if targets[i] == targets[i+1]:
            pass
        else:
            ans += 1

    print(ans)
resolve()

Solution (Python):
_ = input()
s = input()
res = [s[0]]
index = 0
for slime in s[1:]:
	if res[index] != slime :
		res.append(slime)
		index += 1
print(len(res))

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

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

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

count = 0

prevColor = S[0]
count += 1

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

print(count)

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

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

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

current = ""
result = []

for slime in S:
    if slime == current:
        continue
    else:
        current = slime
        result.append(slime)
print(len(result))

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

Solution (Python):
from itertools import groupby
N = int(input())
S = list(input())
gr = groupby(S)
ans = 0
for key,group in gr:
    ans += 1
print(ans)

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

for item in S:
    if temp != item:
        count += 1
    temp = item

print(count)

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

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

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
s = input().strip()
acc = 0
prev = '
for i in range(n):
  if s[i] != prev:
    acc += 1
  prev = s[i]
print(acc)

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

for x in b:
    if x!=s:
        n+=1
    s=x
print(n)

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


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

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

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

count = 1
for i in range(n):
    cur_c = s[i]
    if i == 0:
        before_c = cur_c
        continue

    if cur_c != before_c:
        count += 1
    before_c = cur_c

print(count)

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    S = str(input().strip())

    cnt = 0
    color = '_'
    for s in S:
        if s == color:
            continue
        cnt += 1
        color = s

    return cnt

if __name__ == '__main__':
    print(main())

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

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

print(t)

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

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

Solution (Python):
import sys


		
def main():
	a = int(input())
	s = input()
	if a == 1:
		return 1
	
	cc=s[0]
	count=1
	for c in s[1:]:
		
		if c != cc:
			count+=1
			cc=c
	
	return count
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

Solution (Python):
from itertools import groupby

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

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

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

print(ans)

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

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    S = input()

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

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

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

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