Problem:
 Score : 300 points    Problem Statement There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i -th slime from the left has the color that corresponds to the i -th character of S .  Adjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.  Ultimately, how many slimes will be there?      Constraints  1 \leq N \leq 10^5  |S| = N  S consists of lowercase English letters.         Input Input is given from Standard Input in the following format:  N  S       Output Print the final number of slimes.        Sample Input 1 10
aabbbbaaca      Sample Output 1 5  Ultimately, these slimes will fuse into abaca .       Sample Input 2 5
aaaaa      Sample Output 2 1  All the slimes will fuse into one.       Sample Input 3 20
xxzaffeeeeddfkkkkllq      Sample Output 3 10

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

groups = 0
s_prev = -1
for s in S:
    if s != s_prev:
        groups += 1
    s_prev = s

print(groups)

Solution (Python):
_,s=open(0)
print(sum(s!=t for s,t in zip(s,s[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()
answer = [S[0]]
for i in range(1, N):
    if S[i] != S[i-1]:
        answer.append(S[i])
print(len(answer))

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

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

ans += 1
print(ans)

Solution (Python):
n = int(input())
ans = 0
pre = None
for c in input():
    if c != pre:
        ans += 1
        pre = c
print(ans)

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

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

print(ans)

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

sys.setrecursionlimit(10**7)
inf=10**20
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 [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  s=list(S())

  _a=''
  ans=[]

  while len(s)>0:
    if _a==s[-1]:
      s.pop()
    else:
      _a=s.pop()
      ans.append(_a)

  return len(ans)


print(main())

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

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

Solution (Python):
input()
S = [i for i in input()]
point = 0
del_list = list()
for i in range(point,len(S)-1):
  if S[i] == S[i+1]:
    del_list.append(i)
for i,j in enumerate(del_list,0):
  del S[j-i]
      
print(len(S))

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

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

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

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

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

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

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

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

Solution (Python):
n=int(input())
l=list(input())
l.append('0')
ans=0
for i in range(n):
    if l[i]!=l[i+1]:
        ans+=1
print(ans)

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

out = 0
now = ""

for i in range(len(L)):
  if L[i] != now:
    out += 1
    now = L[i]
print(out)

Solution (Python):



n = int(input().rstrip())
s = list(input())
count = 0
 
 
for i in range(n):
    
    try:
        if s[i] == s[i+1]:
            count += 1
    except IndexError:
        break
        
        
print(len(s) - count)

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

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

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

print(ans)

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

a=N

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

print(a)

Solution (Python):
N = int(input())
S = list(input())
char = ''
n = 0
for i in S:
    if not char == i:
        n += 1
    char = i
print(n)

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

if ans == '' or (ans[-1] != S[-1]):
    ans += S[-1]

print(len(ans))

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

ans=N

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

print(ans)

Solution (Python):
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)
ct = 1
n = ip()
a = input()
current = a[0]
for i in range(1,n):
    if current != a[i]:
        current = a[i]
        ct+=1
print(ct)

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 = input()
s = list(input())
ss = ''
sss = []

for i in s:
    if i != ss:
        sss.append(i)
    ss = i

print(len(sss))

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

lis = list(str(S))

count = N
c = 0

for i in lis:
    c += 1
    if len(lis) == c:
            print(count)
    elif lis[c - 1] == lis[c]:
        count -= 1

Solution (Python):
import sys

n = int(input())
s = input()
i = 0
ck = ''
result = ''
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		if s[i] != ck:
			ck = s[i]
			result += ck
	elif s[i] != ck:
		ck = s[i]
		result += ck

if s[-1:] != ck:
	result += s[-1:]

print(len(result))

Solution (Python):
from itertools import groupby

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

G = [len(tuple(v)) for k, v in groupby(S)]
print(len(G))

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

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

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

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

print(N)

Solution (Python):

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

sum = 0

pre = ''
for i in s:
    if i == pre:
        pre = i
        continue
    else:
        pre = i
        sum += 1

print(sum)

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

import re


def nchars(s, n):
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
        
ans = list(nchars(S,1))
ans = len(ans)
print(ans)

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

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

m = 0

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

Solution (Python):
import re
n = int(input())
s = input()
ans = s
for i in range(26):
  ans = re.sub("([a-z])\\1","\\1",ans)
print(len(ans))

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

cnt = 0

now = ''
for i in s:
  if now != i:
    cnt += 1
  now = i

print(cnt)

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

Solution (Python):
n=int(input())
d=str(input())
total=""
a=0
while a!=n:
    total+=d[a]
    a+=1
    if a==n:
        break
    while d[a]==d[a-1]:
        a+=1
        if a==n:
            break
    
print(len(total))

Solution (Python):
N = int(input())
slime = str(input())
ans_list = []
previous_slime = ""

for i in range(N):
  
  if slime[i] != previous_slime:
    ans_list.append(slime[i])
    previous_slime = slime[i]

print(len(ans_list))

Solution (Python):
N = int(input())
S = input()
buffer = S[0]
output = buffer
for s in S:
    if s == buffer:
        pass
    else:
        buffer = s
        output += s
print(len(output))

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 = input()
S = input()
count = 0
result = ''

for s in S:
    
    count += 1

    if result == '':
        result += s
    else:
        if result[-1] != s:
            result += s
    if count >= int(N):
        
        break


print(len(result))

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):
n = int(input())
s =  [str(m) for m in list(str(input()))]
nd = list()
for i in range(n-1):
        if s[i] != s[i+1]:
            nd.append(s[i])

print(len(nd)+1)

Solution (Python):

N = int(input())
S = input()
l = 0
S = list(S)
while len(S) != l+1:
    if S[l] == S[l+1]:
        del S[l]
    else:
        l += 1
print(len(S))

Solution (Python):
n = int(input())
data = list(input().rstrip())
ans = [data[0]]
cnt = 0
i = 0

for _ in range(n):
  if ans[-1] != data[i]:
    ans.append(data[i])
  i += 1
    
print(len(ans))

Solution (Python):
n=int(input())
s=input()
ss=set(s)
l=s[0]
count=1
for j in range(n):
    if l!=s[j]:
        count+=1
        l=s[j]
print(count)

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

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

n=int(N)
c = reduce(lambda x,y: x+y if x[-1] != y else x, S)

print len(c)

Solution (Python):
N, S = open(0).read().split()

S = list(S)
cnt=0
for i in range(len(S)):
    for j in range(i+1, len(S)):
        if S[i] == S[i+1]:
            S.pop(i+1)
        else:
            cnt += 1
            
            break
print(len(S))

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

x = re.sub("(.)\\1{1,}", "-", S)
print(len(x))

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

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

print(num)

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

print(result)

Solution (Python):


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

s_shrinked = str()

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

Solution (Python):
import itertools

N = int(input())
L = str(input())

l = [k for k, v in itertools.groupby(L)]

print(len(l))

Solution (Python):
N = int ( input() )
slimes = str( input() )
list_slimes = list( slimes )
while(True):
  counter = 0
  i = 0
  while(i<len(list_slimes)-1):
    if list_slimes[i] == list_slimes[i+1]:
      del list_slimes[i]
      counter += 1
    i += 1
  if counter == 0:
    break

print( len (list_slimes) )

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

S=S +"1"
state=0
bonus_sum=0
gokei=0
bonus=0

for i in range(N):
    
    
    
    
    
    if S[i] != S[i +1 ]:
        gokei=gokei+1
        bonus_sum=bonus_sum +bonus
        bonus=0
    else:
        gokei=gokei +1
        bonus = bonus +1

        
print(gokei - bonus_sum)

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

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

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

previous = S[0]
ans = 1

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

print(ans)

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

con = 0

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

if S[0] == S[-1]:
	print(N - con + 1)
else:print(N - con)

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

for s in set(list(S)):
    S = re.sub(r"{}+".format(s), s, S)

print(len(S))

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

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

print(n-sum)

Solution (Python):
slime_sum = input()
slime_color = input()

slime_result_sum_list = []
tmp_color = ""

for color in slime_color:
    if not slime_result_sum_list:
        slime_result_sum_list.append(color)
        tmp_color = color
        continue
    
    if tmp_color != color:
        slime_result_sum_list.append(color)
        tmp_color = color

print(len(slime_result_sum_list))

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

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

S = input().strip()

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

print(ans)

Solution (Python):

n = int(raw_input())
s = raw_input()


clist = ['aa','bb','cc','dd','ee','ff','gg','hh','ii','jj','kk','ll','mm','nn','oo','pp','qq','rr','ss','tt','uu','ww','vv','xx','yy','zz']

for word in clist:
    while True:
        if s.count(word) > 0:
            s = s.replace(word,word[0])
        else:
            break

print len(s)

Solution (Python):
import sys
sys.setrecursionlimit(1000000)

a =int(input())
B =list(input())

def dfs(x):
    
    C =B[x]
    B[x] = "."
    nx = x + 1
    if nx >= 0 and nx <= a-1 and B[nx] == C:
        dfs(nx)

res = 0
for i in range(a):
        if B[i] != ".":
            
            dfs(i)
            res += 1
print(res)

Solution (Python):
import itertools

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

list2 = [k for k, v in itertools.groupby(S)]

print(len(list2))

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

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

ans = 0

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

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

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

flag = True
while flag:
    flag = False
    i = 0
    while i+1 < len(s):
        if s[i] == s[i+1]:
            flag = True
            s = s[:i] + s[i+1:]
            i += 1
        i += 1

print(len(s))

Solution (Python):
"""
author : halo2halo
date : 19,Oct,2019
"""

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
words = readline().rstrip()
preword = '1'
ans = 0
for word in words:
    if preword != word:
        ans += 1
        preword = word

print(ans)

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

Solution (Python):
n = int(input())
s = list(input())
p = []
i = 0
while i < n:
    if i < n-1 and s[i] == s[i+1]:
        p.append(s[i])
        i += 1
        while i < n-1 and s[i] == s[i+1]:
            i += 1
        i+=1
    else:
        p.append(s[i])
        i += 1
print(len(p))

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

pre = ''
sum = 0
for i in S:
  if pre != i:
    sum += 1
  pre = i
print(sum)

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

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

Solution (Python):
import sys

input = sys.stdin.readline

if __name__ == '__main__':
    N = int(input())
    S = input().strip()
    current_color = ''

    count = 0
    for s in S:
        if current_color != s:
            count += 1
        current_color = s

    print(count)

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

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

print(C)

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

total = []
Y = 0

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

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

l = str(input())

ans = int(1)

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

print(ans)

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

Solution (Python):
n1 =[]
A = int(input())
S = list( input().split()) 
L = list(S[0]) 
for x, y in zip(L, L[1:]):
    if x is not y:
      n1.append(x)
print(len(n1) + 1)

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

s0 = s.pop()

cnt = 1

while s:
    s1 = s.pop()
    if s1!=s0:
        cnt += 1
        s0 = s1
print(cnt)

Solution (Python):
n = int(input())
t = input()
k = [1]
z = 0
s = t[0]
for i in range(1,n):
    if(t[i-1]==t[i]):
        z+=1
    else:
        z=0
    if(z==0):
        k.append(1)
    else:
        z=0

print(len(k))

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

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

cur_c = ""
result = ""

for c in s:
    if c == cur_c:
        continue
    else:
        cur_c = c
        result += c

print(len(result))

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

flag = 1
for i in range(A):
  if i < A-1:
    if B[i] != B[i+1]:
      flag+=1

print(flag)

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

c=s.count(0)
print(n-c)

Solution (Python):
N = str(input())
S = list(input())
answer = []

for s in S:
  if len(answer) == 0:
    answer.append(s)
  elif answer[-1] != s:
    answer.append(s)
print(len(answer))

Solution (Python):
def conbine(text):
    flag = text[0]
    ans = str(flag)

    for i in text:
        if i == flag:
            None
        else:
            ans += str(i)
            flag = i
            continue
            
    ans_num = len(ans)
    return ans_num

input()
print(conbine(input()))

Solution (Python):
import sys

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

a = 0
while True:
    if a == len(S)-1:
        break

    if S[a] == S[a+1]:
        S = S[:a+1]+S[a+2:]
    else:
        a += 1

print(len(S))

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

ans = 1

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

print(ans)

Solution (Python):
a = int(input().split()[0])
b = list(map(str, input().split()[0]))
k = 0
s = 1


while k<len(b) -1:
 t = b[k]
 u = b[k+1]
 
 if not t == u:
  s = s + 1
  
 k = k + 1
print(s)

Solution (Python):

num = int(input())
colors = list(input())
count = 0

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

Solution (Python):
import re

N = input()
S = input()

for i in set(S):
    i_ = i + '+'
    pattern = re.compile(r'%s' % i_)
    S = re.sub(pattern, i, S)
    
print(len(S))

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

Solution (Python):
N = int(input())
S = input()
before_slime = S[0]
slime_num = 0 if len(S) > 1 else 1
same_flg = False
for i, slime in enumerate(S[1:]):
    if before_slime == slime and i == len(S[1:])-1:
        slime_num += 1
    elif before_slime != slime and i == len(S[1:])-1:
        slime_num += 2
    elif before_slime == slime and same_flg:
        before_slime = slime
    elif before_slime != slime and same_flg:
        slime_num += 1
        before_slime = slime
        same_flg = False
    elif before_slime == slime:
        before_slime = slime
        same_flg = True
    else:
        slime_num += 1
        before_slime = slime
print(slime_num)

Solution (Python):
from itertools import groupby

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

ans = 0
for key, val in groupby(s):
    ans += 1

print(ans)

Solution (Python):
N = int(input())
D = input()
S=list(D)
C = 1
X = S[0]
for i in range(N-1):

	if S[i+1]!=X:
		C+=1
		X=S[i+1]

print(C)

Solution (Python):
import re
N = int(input())
S = input()
oldS = S
while 1:
    S = re.sub('a+','a',S)
    S = re.sub('b+','b',S)
    S = re.sub('c+','c',S)
    S = re.sub('d+','d',S)
    S = re.sub('e+','e',S)
    S = re.sub('f+','f',S)
    S = re.sub('g+','g',S)
    S = re.sub('h+','h',S)
    S = re.sub('i+','i',S)
    S = re.sub('j+','j',S)
    S = re.sub('k+','k',S)
    S = re.sub('l+','l',S)
    S = re.sub('m+','m',S)
    S = re.sub('n+','n',S)
    S = re.sub('o+','o',S)
    S = re.sub('p+','p',S)
    S = re.sub('q+','q',S)
    S = re.sub('r+','r',S)
    S = re.sub('s+','s',S)
    S = re.sub('t+','t',S)
    S = re.sub('u+','u',S)
    S = re.sub('x+','x',S)
    S = re.sub('y+','y',S)
    S = re.sub('z+','z',S)
    S = re.sub('v+','v',S)
    S = re.sub('w+','w',S)
    if oldS == S:
        break
    else:
        oldS = S

print(len(S))

Solution (Python):
N=int(input())
S=input()
m=1
i=0
while i<N-1:
  if S[i]!=S[i+1]:
    m+=1
  i+=1
print(m)

Solution (Python):
n=int(input())
s=list(input())
sura=0
qoq=list()

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

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

Solution (Python):


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


tmp = ""
ans = ""
for word in s:
  if word != tmp:
    ans += word
  tmp = word
print(len(ans))

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

count =len(S)

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

print(count)

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


result = []
for i, s in enumerate(list(S)):
    if i == 0:
        result.append(s)
        continue

    if result[-1] == s:
        continue
    else:
        result.append(s)

print(len(result))

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

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

Solution (Python):
num = int(input())
colorlist = list(input())
count = 0
dumy = None

for i in range(0, num): 
  if dumy != colorlist[i]:
    count+=1
  dumy = colorlist[i]
print(count)

Solution (Python):
n = int(input())
h = str(input())
h = list(h)
h2 = []
def mojiretu(n, h):
    h2.append(h[0])
    for i in range(1, len(h)):
            if h[i] != h[i - 1]:
                h2.append(h[i])
    return len(h2)
print(mojiretu(n,h))

Solution (Python):
slime_number = int(input())
slime_colors = list(input())

last_slime = 'ほげ'
result = 0

for i in range(slime_number):
  if last_slime != slime_colors[i]:
    last_slime = slime_colors[i]
    result += 1

print(max(result, 1))

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

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

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

Solution (Python):
n=int(input())
s=list(input())
a=[0]*n
new=[]
for i in range(n):
	if i==n-1:
		a[n-1]=1
		break
	if s[i]==s[i+1]:
		a[i]=0
	else:
		a[i]=1

for i in range(n):
	if a[i]==1:
		new.append(s[i])	
			

print(len(new))

Solution (Python):


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

slimes = [S[0]]
count = 0

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

print(len(slimes))

Solution (Python):


N = input()
S = input()
r = []
for s in S:
    if len(r) == 0 or r[-1] != s:
        r.append(s)
print(len(r))

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

r = 1
for i in range(N):

    if i + 1 != N:
        if S[i] == S[i+1]:
            pass
        else:
            r = r + 1
    else:
        pass

print(r)

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

prior = ""
fusion = ""
for i in range(N):
  if prior != S[i]:
    fusion += S[i]
  prior = S[i]
  
print(len(list(fusion)))

Solution (Python):
N = int(input())
S = list(input())
i = 0
count = 0
while i < N-1:
    while S[i] == S[i+1]:
      i += 1
      if i == N-1:
        break
    if i == N-1:
      break
    count +=1
    i +=1
count +=1
print(count)

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

S = input()

p = '!'

ans = 0

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

Solution (Python):
N=int(input())
li=list(input())
li.append("end")
i=0
while li[i]!="end":
	while li[i]==li[i+1]:
  		del li[i+1]
	i+=1
print(len(li)-1)

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

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


print(len(S))

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

if N > 0:
  ans = 1
else :
    print(0)
    sys.exit(0)

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

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

Solution (Python):
N = int(input())
S = list(input())
count = N
i = 0
while i < N:
  j = i
  c = 0
  while S[i] == S[j]:
    j += 1
    c += 1
    if j == N:
      break
  count -= c-1
  i += c
print(count)

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

Solution (Python):
N = int(input())
S = list(input())
cou = 0
tmp = S[0]
for s in S[1:]:
  if tmp == s:
    cou += 1
  else:
    tmp = s
print(N-cou)

Solution (Python):
input1 = int(input())
input2 = str(input())

result_string = []
for i in range(input1):
    if i > 0 and input2[i] != input2[i-1]:
        result_string.append(input2[i])
    elif i == 0:
        result_string.append(input2[i])

print(len(result_string))

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

Solution (Python):
_ = input()
input_slime_list = list(input())

remain_slime_list = []
for slime in input_slime_list:
    if len(remain_slime_list)==0:
        remain_slime_list.append(slime)
    else:
        if slime!=remain_slime_list[-1]:
            remain_slime_list.append(slime)

print(len(remain_slime_list))

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

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

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

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

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

print(n)

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

import itertools

print(len([[k, len(list(g))] for k, g in itertools.groupby(S)]))

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

def fusion(list_s):
  fusioned_s = ''
  for index, char in enumerate(list_s):
    if index != len(list_s) -1 and char != list_s[index + 1]:
      fusioned_s += char
    elif index == len(list_s) -1:
      fusioned_s += char
      
  return fusioned_s

print(len(fusion(s)))

Solution (Python):
import itertools

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

print(len([k for k, v in itertools.groupby(S)]))

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

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

    cnt += 1
  cp = s[i]


print (cnt)

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

count = 1
while count != len(s) :
	count = 1
	for i in reversed(range(1,len(s))):
		
		if s[i] == s[i-1]:
			s.pop(i)
		else:
			count +=1


print(len(s))

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

checklist = []

for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        checklist.append(S[i])
print(len(checklist)+1)

Solution (Python):
import sys
sys.setrecursionlimit(100000)

def ins(): return input().split()
def ii(): return int(input())
def iil(): return list(map(int, ins()))
def lin(): return list(input())
def iin(): return map(int, ins())


n = ii()
k = input()
t = ''
ans = 0
for i in k:
    if t!=i:
        ans += 1
        t = i
print(ans)

Solution (Python):

import sys
import re


def solve(N: int, S: str):
    result = 0
    for s in set(S):
        regex = re.compile(s + "+")
        
        result += len(regex.findall(S))
    print(result)

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

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

Solution (Python):
N = map(int, input())
S = input()
S_list = list(S) 
S_list_process = []




checkchar = ""
for char in S_list:
    if checkchar != char:
        S_list_process.append(char)
        checkchar = char

print(len(S_list_process))

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

Solution (Python):
import sys
sys.setrecursionlimit(int(1e6))

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

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

Solution (Python):
import sys
N=int(input())
s=list(str(input()))
i=0
ans=0
if N==1:
  print(1)
  sys.exit()
while i!=N-1:
  count=1
  ans+=1
  while i+count<=N-1 and s[i]==s[i+count]:
    count+=1
  i+=count
  if i==N:
    print(ans)
    sys.exit()
  elif i==N-1:
    if s[N-2]!=s[N-1]:
      ans+=1
    print(ans)
    sys.exit()
print(ans)

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

k = 0
p = ''
count = 1

for s in S:
	if k != 0:
		if p == s:
			pass
		else:
			count += 1
	p = s
	k += 1
print(count)

Solution (Python):
N = int(input())
array = list(input())
now_value=""
for item in array:
	if item == now_value:
  		N = N-1
	else:
		now_value = item
print(N)