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

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

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

Solution (Python):

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

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

Solution (Python):
from itertools import*
_,s=open(0)
print(len(list(groupby(s)))-1)

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

S = input()

prev = -1
count = 0

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

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
inf = 10**20

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

Solution (Python):
N = int(input())
string = input()
total = 0
cur = None
for c in string:
    if c != cur:
        total += 1
        cur = c
print(total)

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

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

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

Solution (Python):
n = int(input())
s = input()
l = 0
ans = 0
while l < n:
    r = l
    while r < n and s[r] == s[l]:
        r += 1
    ans += 1
    l = r
print(ans)

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


def rle(s):
    import itertools
    return list(map(lambda x: (x[0], len(list(x[1]))), itertools.groupby(s)))


print(len(rle(s)))

Solution (Python):
N = int(input())
s = input()
if N == 1:
    print(1)
    exit(0)
ans = 1
t = s[0]
for k in range(1,N):
    if s[k] != t:
        ans += 1
        t = s[k]
print(ans)

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

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

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

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

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

Solution (Python):
n=int(input())
s=input()
before=s[0]
kotae=1

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

print(kotae)

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

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

Solution (Python):
N = int(input())
S = input()
ans = 0
for s1, s2 in zip(S, S[1:]):
    if s1 != s2:
        ans += 1
ans += 1
print(ans)

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

Solution (Python):










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

x = None
ans = 0
for c in s:
    if c != x:
        x = c
        ans += 1
print(ans)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

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

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

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = read().rstrip()

prev = 0
answer = 0
for x in S:
    if x != prev:
        answer += 1
    prev = x

print(answer)

Solution (Python):
N = int(input())
S = input() + '.'

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

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

s = input()

new = s[0]

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

print(len(new))

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

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    cnt= 0
    for i in range(1, n):
        if s[i] != s[i-1]:
            cnt += 1
    print(cnt + 1)


if __name__ == '__main__':
    slove()

Solution (Python):

N = int(input())

S = input()

S += " "
ans = 0
for i in range(N):

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

print (ans)

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

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

ans = 1
re = S[0]

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

print(ans)

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools

import queue
from collections import deque



def main():
    num = int(input())
    s = list(input())
    ans = 0
    for i in range(1, num)[::-1]:
        if s[i] == s[i - 1]:
            ans += 1

    print(len(s) - ans)






if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = input()
ans = 0
prev = ""
for c in s:
    if prev != c:
        ans += 1
        prev = c
    else:
        continue
print(ans)

Solution (Python):
import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7
INF = float('inf')

def sol():
    N = int(input())
    S = input().rstrip()

    ans = 0
    prev = -1

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

    print(ans)

sol()

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

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

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

Solution (Python):
def run_length_compress(string):
    """文字列をランレングス圧縮する
    例) string = "aabccaaabb" -> [(2, a), (1, b), (2, c), (3, a), (2, b)]
    """
    string = string + "@" 
    n = len(string)

    begin = 0
    end = 1
    cnt = 1
    ans = []
    while True:
        if end >= n:
            break
        if string[begin] == string[end]:
            end += 1
            cnt += 1
        else:
            ans.append((cnt, string[begin]))
            begin = end
            end = begin + 1
            cnt = 1

    return ans

n = int(input())
s = input()
ans = run_length_compress(s)
print(len(ans))

Solution (Python):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))



N = I()
S = str(input())

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

print(ans)

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

Solution (Python):
n1 = int(input())
s1 = input()

r1 = 0
c1 = ""
for i1 in range(n1):
    if s1[i1] != c1:
        r1 += 1
        c1 = s1[i1]

print(r1)

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

Solution (Python):

import sys
INF = float("inf")


def Run_length_encoding(S: str):
    """AAABBC -> [(A, 3), (B, 2), (C, 1)]
    """
    ans = []
    curr = S[0]
    counter = 0
    for c in S:
        if c == curr:
            counter += 1
        else:
            ans.append((curr, counter))
            curr = c
            counter = 1
    ans.append((curr, counter))
    return ans


def solve(N: int, S: str):
    print(len(Run_length_encoding(S)))
    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):


from collections import deque, defaultdict
import itertools as ite
import sys
import math
import decimal

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from itertools import groupby
    n=int(input())
    s=input()
    G=groupby(s)
    ans=0
    for key,it in G:
        ans+=1
    print(ans)
resolve()

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

Solution (Python):


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

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

count = 0
x = S[0]
for i in range(N):
  if x != S[i]:
    x = S[i]
    count += 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

print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = input()
    k = s[0]
    ans = 1
    for i in range(1,n):
        if k != s[i]:
            ans += 1
            k = s[i]
    print(ans)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
from itertools import groupby as gb

n = int(input())
s = input()
g = gb(list(s))
print(len(list(g)))

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

ANS=1

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

print(ANS)

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

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

Solution (Python):
n = int(input())
s = list(input())
count = 0
pre = s[0]
for i in s[1:]:
    if pre != i:
        count += 1
        pre = i

print(count+1)

Solution (Python):
from itertools import groupby
N = int(input())
S = input()
ans = len(list(groupby(S)))
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n = getN()

s = input().strip()

ans = 0
tmp =  "_"
for c in s:
    if tmp != c:
        ans += 1

    tmp = c

print(ans)

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

main()

Solution (Python):
def ranlength(A):
    num = list(A)
    count = 1
    result = ''
    table = []
    for i in range(len(num)):
        try:
            if num[i] == num[i+1]:
               count = count + 1
            else:
                result += str(num[i]) + str(count)
                table.append(count)
                count = 1
        except:
            result += str(num[i]) + str(count)
            table.append(count)
    return(table)

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

print(len(ranlength(S)))

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

Solution (Python):

import sys

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

Solution (Python):
from itertools import groupby

n = int(input())
s = input()
print(len(list(groupby(s))))