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

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

def p(S):
  s = len(S)
  e = 0
  cnt = 0
  while s != e:
    cnt += 1
    if cnt > N:break
    s = len(S)
    for i in range(s-1):
      if i >= len(S)-1:break
      if S[i] == S[i+1]:S.pop(i)
      e = len(S)
  return len(S)

print(p(S))

Solution (Python):
i = 0
N = int(input())
S = list(input())
while(i < N-1) :
    if S[i] == S[i+1]:
        S.pop(i)
        N = len(S)
        continue
    i += 1
print(N)

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

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

s = input()


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

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

len = 1

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

print(len)

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

ans=0
w=s[0]
for i in range(1,len(s)):
    if s[i-1] != s[i]:
        w += s[i]
    else:
        continue

ans= len(w)
print(ans)

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

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

for i, e in enumerate(sl):
    if i > 0:
        if e == sl[i-1]:
            anssl[i-1] = False
ans = [i for i in anssl if i != False]
print(len(ans))

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

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

import itertools
list = [k for k, v in itertools.groupby(s)]
print(len(list))

Solution (Python):
N = int(input())
s = input()
ans = ''
temp = ''
for i in range(N):
    if(s[i] != temp):
        temp = s[i]
        ans += s[i]
print(len(ans))

Solution (Python):
a=int(input())
b=input() 
c=list(b)
d=[]
for i in range(a-1):
  if c[i]==c[i+1]:
    d.append(0)
  else:
    d.append(1)
print(sum(d)+1)

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

sum = 1
s_list = list(s)[1:]

checker = list(s)[0]

for c in list(s_list):
    if (c != checker):
        sum = sum + 1
        checker = c

print(sum)

Solution (Python):
def main():
    number_of_slimes = int(input())
    slime_list = list(input())

    print(len(remove_adjacent(slime_list)))
    

def remove_adjacent(li):
    n1  = []
    n1.append(li[0])

    for i in range(1,len(li)):
        if li[i] != li[i-1]:
            n1.append(li[i])
    return n1

main()

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

Solution (Python):
import re

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

rex = r'(.)\1{0,}'
pattern = re.compile(rex)
ans = pattern.findall(S)

print(len(ans))

Solution (Python):
N = int(input())
S = input()
tmp = S[0]
ret = tmp
for i in S:
  if tmp == i:
    tmp = i
  else:
    ret += i
    tmp = i
print(len(ret))

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

Solution (Python):

num = int(input())
colors = list(input())
i = 0
while i+1 != len(colors):
  if colors[i] == colors[i+1]:
    colors.pop(i+1)
  else:
    i += 1
print(len(colors))

Solution (Python):
N = input()
S = input()
S = list(S)
m = []
for i, s in enumerate(S):
  if i == 0:
    m.append(s)
  if i >= 1 and S[i] != S[i - 1]:
    m.append(s)
print(len(m))

Solution (Python):
from itertools import groupby
N = int(input())
S = input()

tmpS = ''
for key, value in groupby(S):
  tmpS = tmpS + key

print(len(tmpS))

Solution (Python):
import re
N = int(input())
S = input()
while re.search("(.)\\1",S):
    S = re.sub("(.)\\1", "\\1", S)
print(len(S))

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

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

print(len(ans))

Solution (Python):

n = int(input())

s = input()

ans = s[0]


for i in range(1, len(s)):

    if s[i - 1] == s[i]:
        continue
    ans += s[i]
        


print(len(ans))

Solution (Python):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

print(res)

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

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

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

Solution (Python):
n=int(input())
s=input()
t=0
for i,c in enumerate(s):
  if i>0 and c==s[i-1]:
    pass
  else:
    t+=1
print(t)

Solution (Python):


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

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

print("{}".format(len(S2)))

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

ans = [[k, len(list(g))] for k, g in itertools.groupby(s)]
print(len(ans))

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

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

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


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np

n = input()
s = np.array(list(input()))
n = int()

color = int(1)

for index,value in enumerate(s[1:]):
  if value != s[index]:
    color += 1

print(color)

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

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

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

Solution (Python):
N = int(input())
S = list(str(input()))
ans = 0
cur = ''
for s in S:
  if cur != s:
    ans += 1
    cur = s
print(ans)

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

Solution (Python):



def solve(*args: str) -> str:
    n = int(args[0])
    s = args[1]

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

    return str(q)


if __name__ == "__main__":
    print(solve(*[input() for _ in range(2)]))

Solution (Python):


N = int(input())
S = input()
sum = 1
for i in range(1, N):
  if S[i] != S[i-1]:
    sum+=1
print('{}'.format(sum))

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

count = 1

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

print(count)

Solution (Python):
import re
N = input()
S = input()
slimes = re.sub('(.)\\1{1,}', 'X', S)
print(len(slimes))

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

print(len([n for i, n in enumerate(b) if i == 0 or n != b[i-1]]))

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

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

print(ans)

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

Solution (Python):

import sys


def solve(N: int, S: str):
    l = list(S)
    while (True):
        sl = []
        cur = ''
        for v in l:
            if cur == v:
                continue
            sl.append(v)
            cur = v
        if len(l) == len(sl):
            print(len(l))
            break
        l = sl
    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 = input()
idx = 0
idx = 1
ans = 1
if n == 1:
    print(1)
else:
    tmp = s[0]
    while(idx<n):
        if s[idx]==tmp:
            idx += 1
        else:
            tmp = s[idx]
            idx += 1
            ans +=1
    print(ans)

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

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

prev = s[0]
count = 1

for i in s:
    if i != prev:
        count += 1
    prev = i

print(count)

Solution (Python):
N = input()
d = sorted(map(str, input().split()))
cnt = 0
tmp = ''
for i in range(0, int(N)):  
    if d[0][i] != tmp:
        cnt += 1
    tmp = d[0][i]

print(cnt)

Solution (Python):
import itertools
N = int(input()) 
strs= input()
x = [[k, len(list(g))] for k, g in itertools.groupby(strs)]
print(len(x))

Solution (Python):

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

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

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

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

print(count)

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

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

result = int(test_s.count('1')) + 1
if result == 0:
    print(1)
else:
	print(result)

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

print(len(L)+1)

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

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

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

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

Solution (Python):
a=input()
a=int(a)
b=input()
lis=[]
c=b[0]
flag=0
for i in range(a-1):
    if i>0:
        c=b[i]
    if b[i+1]==c:
        continue
    else:
        lis.append(b[i])
if len(lis)>1:
   flag=1
else:
    lis={"a"}
if flag==1:
     if lis[-1]!=b[-1]:
        lis.append(b[-1])

print(len(lis))

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

print(m)

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

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




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

print(len(ss))

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

counter=1

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

print(counter)

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

s_out = ''
for s in s_list:
  if len(s_out) == 0 or s_out[-1] != s:
    s_out += s
  else:
    pass
  
print(len(s_out))

Solution (Python):
import re
n = int(input())
s=input()
res = re.sub(r"(.)\1{1,}", 'z', s)
print(len(res))

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

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

print(color)

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

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

Solution (Python):
N=int(input())
S=input()
pre_color=None
ans=0
for i,color in enumerate(S):
    if color!=pre_color:
        ans+=1
    pre_color=color
print(ans)

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

ans = [S[0]]

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

print(len(ans))

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

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

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

print(len(s_true))

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

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

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

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

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

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

inputlist = list(S)
c_list = [0]*len(S)



ans = 1


for i in range(N):

    if i == N-1:
        break
    if inputlist[i] != inputlist[i+1]:
        ans += 1

print(ans)

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

count = 1
last_chr = colors.pop(0)

while len(colors) > 0:
  if(last_chr != colors[0]):
    count += 1
  last_chr = colors.pop(0)

print(count)

Solution (Python):
import re
N=int(input())
D=input()
ans=N
match=re.compile("(.)\\1{%d,}" % 1)
while True:
    m=match.search(D)
    if not m:
        break
    ans-=(len(m.group(0))-1)*(D.count(m.group(0)))
    D=D.replace(m.group(0),m.group(0)[0])

print(ans)

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

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

S = S + 'A'
last = S[0]
cnt = 0
for s in S[1:]:
    if last == s:
        continue
    else:
        cnt += 1
        last = s
print(cnt)

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

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

Solution (Python):
N = int(input())
S = input()
stock = None
slime = 0

for n in range(N):
    if n == 0:
        stock = S[n]
        slime += 1
    else:
        if stock == S[n]:
            stock = S[n]
        else:
            stock = S[n]
            slime += 1

print(slime)

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

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

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

slime = N - fusion

print(slime)

Solution (Python):

import sys


def solve(N: int, S: str):
    now = S[0]
    ans = 1
    for s in S[1:]:
        if now != s:
            ans += 1
            now = s
    print(ans)
    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(input())
ans = 1
pre = S[0]

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

print(ans)

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

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

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

print(N)

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

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

print(len(s[cnt:]))

Solution (Python):

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


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

print(sum)

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

s = S[0]
a = [s]
i = 0
while i < len(S):
  if s != S[i]:
    s = S[i]
    a.append(s)
    
  i+=1
    
print(len(a))

Solution (Python):
n = int(input())
s = input()
slime = list()
for val in s:
    slime.append(val)
sel = 0
while sel+1 != len(slime):
    if slime[sel] == slime[sel+1]:
        slime.pop(sel+1)
    else:
        sel += 1
print(len(slime))

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

Solution (Python):


import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False


        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = [int(e) for e in lines[0].split(" ")][0]
    s = lines[1]

    return (n, s)


def solve(n, s):

    
    last = None
    result = []
    for i in range(n):
        if s[i] != last:
            result.append(s[i])
        last = s[i]


    if debug:
        log("result=%s" % result)
        
    return len(result) 


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, end=' ')
    else:
        print("%s" % result)

if __name__ == '__main__':

    main()

Solution (Python):

N = int(input())
S = input()
L = [s for s in S]

M = []
cnt = 0
ans_c = 0

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

for i in range(N-1):
    if L[i]==L[i+1]:
        cnt += 1
    else:
        ans_c += cnt
        cnt = 0
    if i == N-2:
        ans_c += cnt
print(N-ans_c)

Solution (Python):
import sys
N = int(input())
S = input()
if N == 1:
    print("1")
    sys.exit()
ans = 0
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans += 1
    if i == N - 2:
        ans += 1

print(ans)

Solution (Python):
n = int(input())
s = input()
ans = []
i = 0
while i != n:
    cnt = 1
    for j in range(i+1,n):
        if s[i] == s[j]:
            cnt+=1
        else:
            break
    ans.append(s[i])
    if cnt>=2:
        i+=cnt
    else:
        i+=1

print(len(ans))

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

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

cnt = 1
col = S[0]

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

  

print(cnt)

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

print(len(fusion))

Solution (Python):
from sys import stdin
import re

N = int(stdin.readline())
S = stdin.readline()

tmp = " "
num = 0
for c in S:
    if tmp != c:
        num = num + 1

    tmp = c


print(num - 1)

Solution (Python):
n = int(input())
s = list(input())
    
ans = 0
before_c = None
    
for c in s:
    if before_c is None:
        before_c = c
    elif c == before_c:
        continue
    else:
        before_c = c
        ans += 1
            
if c == before_c:
    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())
S.reverse()

result = []
pre = S.pop()
while len(S) > 0:
    x = S.pop()
    if pre != x:
        result.append(pre)
        pre = x
result.append(pre)

print(len(result))

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

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

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

count = 0
temp = ""

for s in S:
    if s != temp:
        count += 1
    temp = s
print(count)

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

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

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

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

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

pre = s[0]
ans = []
ans.append(pre)

for i in range(1,n):
    if not s[i] == pre:
        ans.append(s[i])
    pre = s[i]

print(len(ans))

Solution (Python):

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

ans = 0
tmp = s[0]
cnt = 1
pos = 0

while True:
    if cnt >= n:
        ans += 1
        break

    if s[cnt] != tmp:
        pos = cnt
        ans += 1
    
    tmp = s[cnt]
    cnt += 1

print(ans)

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

_n = int(input())
_s = input()[:-1]
slist = [item for item in _s]


def chker(sl):
    if len(sl) == 1:
        print(1)
        return

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

    print(cnt)


chker(slist)

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

Solution (Python):
from __future__ import division

n = input()
s = input()

n = int(n)

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

cur = None

pat = 0
for c in range(N):
    if S[c] == cur:
        continue
    elif cur != None:
        cur = S[c]
        pat += 1
    elif c == N-1:
        pat += 1
    elif S[c] != cur:
        cur = S[c]
        pat += 1
print(pat)

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

for i in range(len(s)-1, 0, -1):
  if(s[i]==s[i-1]):
    del s[i]    

print(len(s))

Solution (Python):
N = int(input())
S = input()
ans = 1
if len(S) == 1:
    print(1)
else:
    if len(S) == 2:
        if S[0] == S[1]:
            print(1)
        else:
            print(2)
    else:
        for x in range(len(S)-1):
            curr = S[x]
            if curr == S[x+1]:
                pass
            else:
                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]:
                continue
        else:
                count = count +1 

print(str(count+1))

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

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

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

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

tmp=s[0]
i=0
cnt=1
flag=0
ss=[]
for i in range(1,len(s)):
    if s[i] != tmp:
        cnt+=1
        tmp = s[i]
        flag = 1
        
if flag == 0 and cnt ==0:
    cnt +=1

print(cnt)

Solution (Python):
def solve_c(n, s):
    res = 1
    for i in range(1, n):
        if s[i] != s[i - 1]:
            res += 1
    return res


def main():
    n = int(input())
    s = input()
    res = solve_c(n, s)
    print(res)


def test():
    assert solve_c(10, "aabbbbaaca") == 5
    assert solve_c(5, "aaaaa") == 1
    assert solve_c(20, "xxzaffeeeeddfkkkkllq") == 10


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

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

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

print(cnt)

Solution (Python):
import sys

def main():

	args = sys.argv
	N = int(input())
	S = input()
	C = 1
	
	for i in range(0, N-1):
		if S[i] != S[i+1]:
			C = C+1
	print(C)

if __name__ == "__main__":
    main()

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

prev_char = ''
abr_str = ''
for c in S:
    if c == prev_char:
        pass
    else:
        abr_str += c
        prev_char = c

print(len(list(abr_str)))

Solution (Python):
N = int(input())
S = list(input())
S.append('end')
i = 0
while S[i] != 'end':
    if S[i] == S[i + 1]:
        del S[i]
    else:
        i += 1
print(str(len(S) - 1))

Solution (Python):
n=int(input())
s=input()
stack=[]
for i in s:
  if not stack:
    stack.append(i)
  elif stack[-1]==i:
    stack.append(i)
    stack.pop()
  else:
    stack.append(i)
print(len(stack))

Solution (Python):
slime_count = input()
slime = input()

last_slime_count = 1


for i in range(int(slime_count) - 1):
    if slime[i:i+1] != slime[i+1:i+2]:
        last_slime_count += 1
        
print(last_slime_count)

Solution (Python):
n = int(input())
str = list(input())
total = 1

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

print(total)

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

    if len(s) <= i+1:
        break

    while s[i] == s[i+1]:
        del(s[i+1])
        if len(s) <= i+1:
            break


print(len(s))

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

Solution (Python):
n = int(input())
S = [s for s in input()]
ans = []

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

print(len(ans)+1)

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

print(cnt)

Solution (Python):
n = int(input()) 
s = input() 
import itertools
print(len(''.join(ch for ch, _ in itertools.groupby(s))))

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

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

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

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

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

last=s[0]
s.pop(0)
ans=1
for i in s:
	if last!=i:
		ans+=1
		last=i

print(ans)

Solution (Python):
import copy

N = int(input())
S = list(input())
l = copy.deepcopy(S)

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

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

print(count)

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

if n>=2:

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

    print(n)

else:
    print("1")

Solution (Python):
N = int(input())
str = input()
count = N
z = 0
for i in str:
    if(z == N-1):
        break
    elif(i == str[z+1]):
        count -= 1
    z += 1
print(count)

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

Solution (Python):
import sys


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


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

    prev = None
    ans = 0
    for ch in S:
        if ch != prev:
            ans += 1
            prev = ch

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

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

temp = ""
length = 0

for s in S:
    if temp != s:
        length += 1
        temp = s

print(length)

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

Solution (Python):
N = int(input())
S = input().split()
T = list(S[0])
def slime(N,T):
    n = 1
    for i in range(0,N-1):
        if T[i] != T[i+1]:
            n = n + 1
    return n
print(slime(N,T))

Solution (Python):
n = int(input())
slimes = list(input())
num=1

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




print(num)

Solution (Python):
from collections import deque

n = int(input())
S = input()
slimes = deque(list(S))

remaining_slimes = []
remaining_slimes.append(slimes.popleft())
while len(slimes) > 0:
    if remaining_slimes[-1] == slimes[0]:
        slimes.popleft()
    else:
        remaining_slimes.append(slimes.popleft())
print(len(remaining_slimes))

Solution (Python):
from collections import deque

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

queue = deque(S)
Ans = []

temp = queue.popleft()
Ans.append(temp)

while len(queue) != 0:
    if temp == queue[0]:
        queue.popleft()
    else:
        temp = queue.popleft()
        Ans.append(temp)

print(len(Ans))

Solution (Python):
import itertools
_= input()
l = input()
s = set(l)
ans = 0
sp = itertools.permutations(s, 2)
for i in sp:
    ans += l.count(''.join(i))
    
print(ans+1)

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

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


if __name__ == "__main__":
    test()

Solution (Python):
import re

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

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

print(ans)

Solution (Python):

N=int(input())
S=input()
ans=0

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

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

for i in range(len(s)):

    if i == 0:
        continue

    if s[i] == s[i - 1]:
        pass
    elif s[i] != s[i - 1]:
        duplicate += 1

print(duplicate)