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

import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N = II()
    S = input()
    count = 0
    pre = -1
    for s in S:
        if s != pre:
            count += 1
            pre = s
    print(count)
if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    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):
n  = int(input())
s = input()
ans = 0
now = ""
for ss in s:
    if now  == "":
        now = ss
        ans += 1
    elif now == ss:
        continue
    elif now != ss:
        ans += 1
        now = ss
print(ans)

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

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

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

Solution (Python):
n = int(input())
l = list(input())
t = 0
c = 0
for i in l:
	if i!= t:
		c += 1
		t = i
print(c)

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

prev = ""
res = ""
for s in S:
    if s != prev:
        res += s
        prev = s

print(len(res))

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

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    s = input()
    ans = 1
    for i in range(1, len(s)):
        if s[i] == s[i-1]:
            continue
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
S = list(map(str, input()))
ret = 1

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

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

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

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

print(ans)

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

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

ans = []
last = '1'
for i in s:
    if i != last:
        ans.append(i)
        last = i
print(len(ans))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True


def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()
    S = SI()

    current = ''
    cnt = 0
    for c in S:
        if c == current:
            pass
        else:
            cnt += 1
        current = c
    print(cnt)


solve()

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

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

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, S):
    ans = 1
    for i in range(0, N-1):
        if S[i] != S[i+1]:
            ans += 1

    return ans


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
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().rstrip() + "

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

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

Solution (Python):


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

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

print(ans+1)

Solution (Python):
n = int(input())
s = list(input())
ans = 1
tmp = s[0]
for t in s:
  if tmp == t:
    pass
  else:
    tmp = t 
    ans += 1

print(ans)

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

Solution (Python):
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()
s = input()
res=0

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

print(n-res)

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

c=0

v=""
for i in range(n):
    p=s[i]
    if p!=v:
        c+=1
        v=p
print(c)

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

ans = 0
cur = 0
while cur < n:
    j = cur
    while j < n and s[j] == s[cur]:
        j += 1
    ans += 1
    cur = j
print(ans)

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

ans = 0

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

Solution (Python):
import sys
import math
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
s = ns()
pre = s[0]
c = 1
for si in s[1:]:
    if si != pre:
        c += 1
        pre = si
print(c)

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

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

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

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

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

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

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

print(kosuu)

Solution (Python):
def main():

    N = int(input())
    S = input()
    stack = []
    for i in range(N):
        if len(stack) == 0 or stack[-1] != S[i]:
            stack.append(S[i])
    return len(stack)

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)

def main():
    n = int(input())
    s = input()
    ans = 1
    pre = s[0]
    for c in s[1:]:
        if c != pre:
            ans += 1
            pre = c

    print(ans)

main()

Solution (Python):
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

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

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



if __name__ == '__main__':
    main()

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
s=input().rstrip()
now='X'
ans=0
for i in s:
    if i==now:
        pass
    else:
        ans+=1
        now=i
print(ans)

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

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

print(ans)

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

Solution (Python):
from collections import defaultdict, deque, Counter
import sys
import heapq
import math



sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


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

    r = 1
    b = s[0]
    for i in range(1, N):
        if s[i] == b:
            continue
        r += 1
        b = s[i]
    print(r)


if __name__ == '__main__':
    main()

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

res = 1
now = S[0]

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

print(res)

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

now=S[0]
ans=0
for i in range(1,n):
  if now!=S[i]:
    ans+=1
    now=S[i]
print(ans+1)

Solution (Python):

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

sum = 1
now = S[0]
for i in range(1, N):
	if now != S[i]:
		sum += 1
		now = S[i]
print(sum)

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

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

    print(cnt)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
inf = float("inf")





def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

n = int(input())
string = input()
last = string[0]
curr = 1
for i in range(1,n):
    if string[i]==last:
        continue
    else:
        curr+=1
        last = string[i]
print(curr)

Solution (Python):
n = int(input())
s = input()
pre, ans = '
for e in s:
  if e != pre:
    ans += 1
  pre = e
print(ans)

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

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

print(ans)

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

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

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

count = 1
tmp = S[0]
i = 1
while i < N:
    if S[i] == tmp:
        i += 1
    else:
        count += 1
        tmp = S[i]
        i += 1

print (count)

Solution (Python):
input()
a,b=0,""
for i in input():
    if b!=i:
        b=i
        a+=1
print(a)

Solution (Python):

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

A = []
for i in range(N):
    if i == 0:
        A.append(S[0])
    else:
        if A[-1] == S[i]:
            pass
        else:
            A.append(S[i])
            
print(len(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 = input()

res = 0
pre = ""
for s in S:
    if pre != s:
        res += 1
        pre = s

print(res)

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

ans = 0
for i, Si in enumerate(S):
    if i == 0:
        ans += 1
        Si_prev = Si
    else:
        if Si != Si_prev:
            ans += 1
            Si_prev = Si
        else:
            continue

print(ans)

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

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

s = input()

count = 1

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

print(count)

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = LI()
    s = S()
    ans = 0
    pre = 0
    for ss in s:
        if ss != pre:
            ans += 1
        pre = ss
    print(ans)

if __name__ == '__main__':
    main()

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

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

import itertools
print(len(list(itertools.groupby(ss))))

Solution (Python):
import itertools
n = int(input())
s = input()
d = itertools.groupby(s)
print(len(list(d)))

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

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()
ans = 1
tmp = S[0]
for i in range(1,N):
	if tmp == S[i]:
		continue
	else:
		ans += 1
		tmp = S[i]

print(ans)

Solution (Python):
import sys, 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
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

N = INT()
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 = []
ans.append(s[0])

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

print(len(ans))

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


n = I()
s = S()
pre = s[0]
cnt = 1
for i in range(1, n):
    if pre != s[i]:
        cnt += 1
        pre = s[i]

print(cnt)

Solution (Python):
N=int(input())
S=input()
S+='1'
count=0

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

print(count)

Solution (Python):
nm = lambda : map(int,input().split())
nl = lambda : list(nm())

n = int(input())
l = list(input())
t = [0]
for x in l:
    if x == t[-1]:
        continue
    t.append(x)
print(len(t)-1)

Solution (Python):

import sys
input = lambda: sys.stdin.readline()[:-1]
sys.setrecursionlimit(10**8)

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

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

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

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

print(sum(int(a!=b) for a,b in zip(S,S[1:]))+1)

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

Solution (Python):
import sys
input = sys.stdin.buffer.readline
N = int(input())
S = list(input())
res = 1
for i in range(1, N):
  if S[i - 1] != S[i]:
    res += 1
print(res)

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



def runLength(s):
    a = []
    for c in s:
        if len(a) == 0 or a[-1][0] != c:
            a.append([c, 1])
        else:
            a[-1][1] += 1
    return a


def main():
    _ = int(input())
    S = input().strip()
    print(len(runLength(S)))


if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict


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


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

if __name__ == '__main__':
	main()

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

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

print(ans)

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

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

Solution (Python):
n = int(input())
s = input()
j = 0
k = 0
for i in s:
    if i != j:
        k += 1
    j = i
print(k)

Solution (Python):
N = int(input())
s = input()
last = None
res = 0
for char in s:
  if char == last:
    continue
  else:
    res += 1
  last = char
print(res)

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

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

print(answer)

Solution (Python):

from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from random import randint
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
sys.setrecursionlimit(9999)
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001
 
'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''


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

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0
 
	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()
 
	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count("\n") + (not b)
			ptr = self._buffer.tell()
			self._buffer.seek(0, 2), self._buffer.write(
				b), self._buffer.seek(ptr)
		self.newlines -= 1
		return self._buffer.readline()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)
 
	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
	sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop("end", "\n"))
	if kwargs.pop("flush", False):
		file.flush()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()

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

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

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

Solution (Python):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))


n = ni()

s = [_ for _ in input()]

ans = []

last = ""
for i in range(n):
    if s[i] == last:
        continue
    ans += s[i]
    last = s[i]

print(len(ans))

Solution (Python):










import sys
import os
from io import IOBase, BytesIO


def main():
    n = int(input())
    s = list(input())
    i = 0
    j = ""
    ans = 0
    while i != n:
        if s[i] == j:
            i += 1
        else:
            j = s[i]
            ans += 1
            i += 1
    print(ans)


BUFSIZE = 8192


class FastIO(BytesIO):
    newlines = 0

    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        while self._fill():
            pass
        return super(FastIO, self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill()
            self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        py2 = round(0.5)
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2 == 1:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s: self.buffer.write(s.encode("ascii"))
            self.read = lambda: self.buffer.read().decode("ascii")
            self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


def get_array():
    return list(map(int, sys.stdin.readline().split()))


def get_ints():
    return map(int, sys.stdin.readline().split())


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


if __name__ == "__main__":
    main()

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
s=input()
ans=n
for i in range(n-1):
    if s[i]==s[i+1]:
        ans-=1
print(ans)

Solution (Python):
def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]





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

pre = "1"
ans = 0
for c in S:
    if c != pre:
        ans += 1
        pre = c
print(ans)

Solution (Python):
N=int(input())
S=input()
cnt=0
now=''
for c in S:
    if c!=now:
        cnt+=1
        now=c

print(cnt)

Solution (Python):
def getRunLengthEncoding(Ss):
    anss = []
    Ss += '$'
    SPrev = Ss[0]
    num = 1
    for S in Ss[1:]:
        if S == SPrev:
            num += 1
        else:
            anss.append((SPrev, num))
            SPrev = S
            num = 1
    return anss

N = int(input())
Ss = input()

anss = getRunLengthEncoding(Ss)
print(len(anss))

Solution (Python):
abc=list(map(chr,range(97,123)))
n=int(input())
s=input()
for x in abc:
    while x*2 in s:
        s=s.replace(x*2,x)
print(len(s))

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

cl = 0
pre = ''
for i in range(n):
    if s[i] != pre:
        cl += 1
    pre = s[i]
print(cl)

Solution (Python):
input()
from itertools import*
print(len([x for x in groupby(input())]))

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

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


a = S[0]
for c, d in zip(S, S[1:]):
    if c != d:
        a += d
print(len(a))

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
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = list(input())
ans = 0
i = 0
while i < n:
    tmp = s[i]
    while i < n:
        if tmp == s[i]:
            i += 1
        else:
            break
    ans += 1
print(ans)

Solution (Python):
import queue

"""
N = int(input())



A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
N = int(input())
A = input()
S = ""
for a in  A:
	if len(S) == 0 or S[-1]!=a:
		S += a
print(len(S))

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

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

print(ans)

Solution (Python):
N=int(input())
S=input()
prev = ""
ans = N
for i in S:
    if i == prev:
        ans -= 1
    else:
        prev = i
print(ans)

Solution (Python):
n=input()
s=input()
tmp1=""
tmp2=""
ans=0
for i in s:
    tmp1=i
    if tmp1!=tmp2:
        ans+=1
    tmp2=tmp1
print(ans)

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

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

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

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

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n = ni()
s = ns()

bef = ""
ans = 0
for si in s:
    if si != bef:
        ans += 1

    bef = si

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

import sys


def solve(N: int, S: str):

    ans = []
    n = S[0]
    c = 1
    for i in range(1,N):
        if(S[i] == n):
            c += 1
        else:
            ans.append(n)
            n = S[i]
            c = 1
    ans.append(n)

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

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

print(count)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

N = int(input())
S = input()[:-1]
ans = 0
prev = ""
for s in S:
    if s == prev:
        continue
    else:
        prev = s
        ans += 1
print(ans)