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 = input()
a_L = input()
a_L = [val for val in a_L ]

from itertools import groupby
counter = 0

for key, value in groupby(a_L):
    counter += 1

print(counter)

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

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

print(ans)

Solution (Python):
from sys import stdin
def main():
    n = int(input())
    s = input()
    ans = 1
    start = 0
    end = 0
    for i in range(1, len(s)):
        if s[i] != s[start]:
            ans += 1
            start = i
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):

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

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

print(len(R))

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

Solution (Python):
n = input()
s = input()
result = ""
for i, color in enumerate(s):
    if i == 0 or (i > 0 and color != s[i - 1]):
        result += str(color)
print(len(result))

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

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

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

ans = [S[0]]

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

Solution (Python):
def main():
  _ = raw_input()
  slimes = raw_input()
  result = 0
  prev = None
  for color in slimes:
    if prev == None:
      prev = color
      continue
    if color != prev:
      result += 1
      prev = color
  print(result + 1)
     

main()

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

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

current = ''
for i in range(n):
    if s[i] != current:
        after_fusion.append(s[i])
        current = s[i]

print(len(after_fusion))

Solution (Python):



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

res = [s.pop()]
while len(s) > 0:
    tmp = s.pop()
    if tmp != res[-1]:
        res.append(tmp)

print(len(res))

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

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

char = s[0]
cnt = 1

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

print(cnt)

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

digit = 1

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

print(len(s))

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

flag=True

while flag:
    ans=[]
    for i in range(len(s)):
        if i==0:
            ans.append(s[i])
        else:
            if s[i-1]!=s[i]:
                ans.append(s[i])

    if ans==s:
        flag=False
    else:
        s=ans
print(len(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())
d = input()
s = N
for i in range(N-1):
    if d[i] == d[i+1]:
        s -= 1
print(s)

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

res = 0

while True:
    if S == '':
        break

    temp = S[0]
    S = S.lstrip(temp)
    res += 1


print(res)

Solution (Python):
num=int(input().rstrip())
word=input().rstrip()
numlis=list(word)

s=1
for i in range(1,(num)):
    a=(numlis[i-1])
    b=(numlis[i])
    if(a!=b):
        s+=1
        

print(s)

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

Solution (Python):
num = int(input())
line = input()

res = ''
before_color = ''

for item in line:
    if item == before_color:
        pass
    else:
        res += item
    
    before_color = item

print(len(res))

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

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

	ans = 1
	prev = s[0]

	for ch in s[1:] :
		if(ch != prev) :
			prev = ch
			ans = ans + 1

	print(ans)

main()

Solution (Python):
n = int(input())
s = input()
curr = ''
fl = 0
ans = 0
for ch in s:
    if ch != curr:
        fl = 0
        
    
    if fl == 0:
        curr = ch
        fl = 1
        ans += 1

print(ans)

Solution (Python):
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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

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

print(ans)

Solution (Python):
N = int(input())
S = list(input())
pre_word = str()
ans = 0

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

print(ans)

Solution (Python):
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy, copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd


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


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    n = INT()
    s = 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):
import itertools as it

n = input()
s = input()

print(len(list(it.groupby(s, ))))

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

pre = ""
res = 0 
for i in s:
    if i != pre:
        res+=1
    pre = i 
print(res)

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

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

print(a)

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

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

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

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

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

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

print(n-dabu)

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

count = 1
count2 = 1

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

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

print(len(s))

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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
s = list(input())
output = 1
tmp = s[0]

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

if output == 0:
    output =1

print(output)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
def get_sequence(arr):
    if len(arr) == 0:
        return [], []
    elements = []
    nums = []
    n = 1
    prev = arr[0]
    for c in arr[1:]:
        if c == prev:
            n += 1
        else:
            elements.append(prev)
            nums.append(n)
            prev = c
            n = 1
    elements.append(prev)
    nums.append(n)
    return elements, nums

N = int(input())
S = input()
ele, num = get_sequence(S)
print(len(num))

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

Solution (Python):

N = int(input())
S = input().split()

while True:
    s = ''.join([S[i] for i in range(1, len(S)) if S[i] != S[i-1]])
    s = S[0]+s
    if len(s) == len(S):
        break
    else:
        S = s

print(len(S))

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

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

Solution (Python):
from itertools import groupby

N=int(input())
S=list(input())
_ans=0
for key, group in groupby(S):
    _ans += 1
print(_ans)

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

cur_slim = s[0]
res = 1

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

print(res)

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

prev = s[0]
ans = 1

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

print(ans)

Solution (Python):
import itertools
N = int(input())
S = str(input())
ans = "".join(ch for ch,_ in itertools.groupby(S))
print(len(ans))

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

bf = ''
cnt = 0

for i in S:
    if bf != i:
        cnt += 1
        bf = i

print(cnt)

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

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

result = []

prevc = None
sum = 0
for c in S:
  if prevc != c:
    sum += 1
  prevc = c
print(sum)

Solution (Python):
def main():
    N = int(input())
    S = input()
    cnt = sum([1 if S[i] != S[i - 1] else 0 for i in range(1, len(S))]) + 1
    print(cnt)
    

if __name__ == '__main__':
    main()

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

current = ''
result_sum = 0
for i in range(N):
    if i == 0:
        current = S[i]
        result_sum = 1
        continue
    if current == S[i]:
        continue
    result_sum += 1
    current = S[i]

print(result_sum)

Solution (Python):

N = int(input())
S = input().split()

while True:
    s = ''.join([S[i] for i in range(1, len(S)) if S[i] != S[i-1]])
    s = S[0]+s
    if len(s) == len(S):
        break
    else:
        S = s

print(len(S))

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

Ss = list(S)
new_S = ""

for i, s in enumerate(Ss):
    if i == 0:
        new_S += s
        mae_S = s
        continue

    if mae_S == s:
        mae_S = s
        continue

    new_S += s
    mae_S = s

print(len(new_S))

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

c=input()

count = 0

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

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

score = 1

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

print (score)

Solution (Python):
N=input()
S=input()
ans=0
before=S[0]
for s in S[1:]:
    if before==s:
        continue
    else:
        ans+=1
        before=s
print(ans+1)

Solution (Python):
n = int(input())
s = input()
new_s = s + '0'
count = 0
i = 0
while i <= n-1:
    color = new_s[i]
    while new_s[i] == color:
        i += 1
    count += 1
print(count)

Solution (Python):
n=int(input())
s=list(input())
ans=[]
latest=0
for i in range(n):
    if s[i]!=latest:
        ans.append(s[i])
        latest=s[i]
print(len(ans))

Solution (Python):

N = int(input())

S = input()

str_list = list(S)

pre = None
result = ""
for s in S:
    if pre is None:
        pre = s
        result = s

    if s != pre:
        result += s
        pre = s

print(len(result))

Solution (Python):

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


count = 1

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

print(count)

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

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


temp=0

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

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

n = int(input())
s = list(map(str, input()))


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

print(cnt)

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

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

print(result)

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

temp = ""
cnt = 0
for s in S:
    if temp != s:
        temp = s
        cnt += 1

print(cnt)

Solution (Python):

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

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

print(count)

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

result = 1
tmp = slimes[0]

for slime in slimes:
    if slime != tmp:
        result+=1
        tmp=slime
print(result)

Solution (Python):
N = int(input())
S = input()
c = '0'
ans = 0

for i in range(N):
    if c == S[i]:
        continue

    elif i == N-1:
        ans += 1

    else:
        c = '0'

        if S[i] == S[i+1]:
            c = S[i]
            ans += 1

        else:
            ans += 1

print(ans)

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

Solution (Python):
import sys
from itertools import accumulate
input = sys.stdin.readline
def inputs():return [int(x) for x in input().split()]
N = int(input())
S= list(input())
s = []
cnt= 1
for i in range(len(S)-2):
  if S[i]==S[i+1]:
    cnt+=1
  else:
    s.append(cnt)
    cnt=1
s.append(cnt)
print(len(s))

Solution (Python):
N=int(input())
S=list(input())
ret=0
for i in range(N):
    if i==0:
        p=S[i]
        ret=ret+1
    else:
        n=S[i]
        if n==p:
            continue
        else:
            p=n
            ret=ret+1
print(ret)

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

Solution (Python):


import sys
import re

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    S = i2s()
    print(len(re.sub(r'(.)(\1)*', r'\1', S)))
    return

main()

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()
s=list(S)
i=0
while i<N:
    if i==len(s)-1:
        break
    else:
        if s[i]==s[i+1]:
            del s[i]
        else:
            i+=1
print(len(s))

Solution (Python):
N = int(input())
S = 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()
total = 0
prev = ""
for item in s:
    if item!=prev:
        total+=1
    prev = item
print(total)

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

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

out = tako(N, S)
print(out)

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

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

solve()

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

color = S[0]
c = 0
for s in S:
  if s != color:
    c += 1
    color = s

print(c+1)

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

prev_lett = ''
count = len(S)
for i, lett in enumerate(S):
    if i == 0:
        prev_lett = lett
        continue
    else:
        if lett == prev_lett:
            count -= 1
        prev_lett = lett
print(count)

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

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

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

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

print(num+1)

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

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

ans = list(d.pop(0))

while d:
  target = d.pop(0)
  if ans[-1] != target:
    ans.append(target)

print(len(ans))

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

Solution (Python):
N = int(input())
S = input()
now = ""
ans = 0
for i in range(N):
    if S[i] != now:
        ans += 1
        now = S[i]
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):
def solve(colors):
    ans = 0
    cur = None
    for c in colors:
        if c != cur:
            cur = c
            ans += 1
            continue

    return ans


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

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

print(ans)

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

nc = s[0]
count = 1
for c in s[1:]:
    if (c != nc):
        count += 1
        nc = c

print(count)

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

total = 1
temp = s[0]
for i in s:
    if temp == i:
        pass
    else:
        total += 1

    temp = i

print(total)

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

Solution (Python):
N = int(input())
S = input()
x = S[0]
cnt = 1
for c in S[1:]:
    if not c == x:
       cnt += 1
       x = c

print(cnt)

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

A = [s[0]]
count = 0

for si in s[1:]:
    if si != A[count]:
        A.append(si)
        count += 1

print(len(A))

Solution (Python):
n = int(input())
s = input()
ans = ''
i = 0
prev = ''
while i < n - 1:
    if prev != s[i]:
        ans += s[i]
    prev = s[i]
    if s[i] == s[i+1]:
        i += 2
    else:
        i += 1
if not(i > n - 1):
    if prev != s[i]:
        ans += s[i] 
print(len(ans))

Solution (Python):

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

before = S[0]
independent = 1

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


print(independent)

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

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

print(len(slime_list))

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

S = list(S)
for i in range(N-1):
    if S[N-1-i]==S[N-2-i]:
        S.pop(N-1-i)
print(len(S))

Solution (Python):


N = int(input())

S = input()

count = 1

tmp_s = S[0]

for i in range(1, len(S)):
    if(S[i] == tmp_s):
        pass
    else:
        count+=1
        
    tmp_s = S[i]
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):

import sys


def solve(N: int, S: str):
    pre = S[0]
    cnt = 1
    for i in range(1, len(S)):
        si = S[i]
        if pre != si:
            cnt += 1
        pre = si
    print(cnt)



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):
a =int(input())
l=input()
q=''
ans=0
for i in range (len(l)):
  if l[i]!=q:
    ans+=1
  q=l[i]
print(ans)

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

print(c)

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

cnt = 1
c = S[0]
for i in range(1,len(S)):
    if c == S[i]:
        pass
    else:
        cnt += 1
        c = S[i]

print(cnt)

Solution (Python):

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

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

Solution (Python):
class Stack(object):
    def __init__(self):
        self.container = []

    def __len__(self):
        return len(self.container)

    def push(self, elem):
        self.container.append(elem)

    def pop(self):
        index = len(self.container) - 1
        if index < 0:
            return None
        ret = self.container[index]
        del self.container[-1]
        return ret

    def compare(self, val):
        return self.container[-1] == val

if __name__ == '__main__':
    N = int(input())
    S = input()
    stack = Stack()
    stack.push(S[0])
    for s in S[1:]:
        if not stack.compare(s):
            stack.push(s)
    print(stack.__len__())

Solution (Python):

import sys


def solve(N: int, S: str):
    sum=1
    l=list(S)
    for i in range(len(S)-1):
        if (l[i]!=l[i+1]):
            sum=sum+1
    print(sum)
    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()

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

print(n-temp)

Solution (Python):
def main():
    N = int(input())
    colors = list(input().rstrip())

    flag = True

    while flag:
        flag = False
        for i in range(len(colors) - 1):
            if colors[i] == colors[i + 1]:
                colors[i] = "$"
                flag = True
        colors = "".join(colors)
        colors = colors.replace("$", "")
        colors = list(colors)

    print(len(colors))


if __name__ == "__main__":
    main()

Solution (Python):
a = input()

a = int(a)

b = input()

sum = 0

temp_char = ''

for char in b:
    if char!= temp_char:
        sum += 1
        temp_char = char

print(sum)

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

s = list(S)
ans = 0
c = s[0]
count = 1
for i in range(1, N):
    if c == s[i]:
        continue
    else:
        ans += count
        c = s[i]
    
print(ans+1)

Solution (Python):
if __name__ == "__main__":
	N = int(input())
	S = input()
	w = "A"
	sum = 0
	for i in range(N):
		if w != S[i]:
			sum += 1
		w = S[i]
	print(sum)

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

if __name__ == '__main__':
    main()

Solution (Python):
class Stack(object):
    def __init__(self):
        self.container = []

    def __len__(self):
        return len(self.container)

    def push(self, elem):
        self.container.append(elem)

    def pop(self):
        index = len(self.container) - 1
        if index < 0:
            return None
        ret = self.container[index]
        del self.container[-1]
        return ret

    def compare(self, val):
        return self.container[-1] == val

if __name__ == '__main__':
    N = int(input())
    S = input()
    stack = Stack()
    stack.push(S[0])
    for s in S[1:]:
        if not stack.compare(s):
            stack.push(s)
    print(stack.__len__())

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

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

print(N-count)

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

Solution (Python):
def myunique(c):
    last = None
    count = 0
    for ci in c:
        if last == ci:
            pass
        else:
            last = ci
            count += 1
    return count

N = int(input())
print(myunique(input()))

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

s = input()

ant = s[0]
soma = 1
res = 1
for i in s[1:]:
    if i == ant:
        soma += 1
    else:
       res += 1
       ant = i

print(res)

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

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

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

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

if __name__ == '__main__':
    solve()

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

cnt=1
prec=s[0]
for c in s:
  if prec==c:
    continue
  else:
    cnt+=1
    prec=c
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):
import sys

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

out = S[0]
for s in S[1:]:
  if out[-1]==s: continue
  out += s
print(len(out))

Solution (Python):
from collections import Counter
N = int(input())
S = input()
ans = 1
for i in range(1,N):
  if S[i-1] == S[i]:
    continue
  else:
    ans += 1
print(ans)

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

ret = [s[0]]
for it in s[1:]:
    if ret[-1] != it:
        ret.append(it)
print(len(ret))

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

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

print(num + 1)

Solution (Python):
input()
s = list(input())
count = 0
prev = None
for x in s:
  if x != prev:
      s[count] = x
      count += 1
      prev = x
print(count)

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

ans = 1

now = S[0]

for s in S:
    if s != now:
        ans += 1
        now = s
    else:
        continue
print(ans)

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

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):
n = int(input())
s = input()
count = 1
for i in range(1,n):
    if s[i] == s[i-1]:
        continue
    else:
        count += 1

print(count)

Solution (Python):
import sys
from itertools import groupby
inputs = sys.stdin.readlines()
n = int(inputs[0])
s = inputs[1].strip()

print(len(list(groupby(s))))

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

import re


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

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

Solution (Python):
from itertools import groupby
N = int(input())
List = list(input())
sum_list = []
for key, value in groupby(List):
    sum_list.append(key)
print(len(sum_list))

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    S = input()

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


main()

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

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

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

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

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

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

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

last = None
ans = 0
for s in S:
    if s != last:
        ans += 1
        last = s
print(ans)

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

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

print(Ans)

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

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

print(count)

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

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

Solution (Python):

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

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

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)