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

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

Solution (Python):



def solve(N, S):
    ans = 0
    last = ''
    for c in S:
        if c != last:
            last = c
            ans += 1
    return ans


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

    ans = solve(N, S)

    print(ans)

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

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

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

print(c)

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

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

from itertools import groupby
ans = len([x[0] for x in groupby(S)])
print(ans)

Solution (Python):
def main():
    n = int(input())
    s = input()
    bef = s[0]
    ans = 1

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

    print(ans)


if __name__ == '__main__':
    main()

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

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


print(len(result))

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

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

for i,x in enumerate(S):
    if i==0:
        cnt=1
    else:
        if prev!=x:
            cnt+=1
    prev=x

print cnt

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

N = int(input())
slime = list(input())
slime.pop(-1)
now = slime[0]
nagasa = len(slime)

for i in range(1, nagasa):
    if now == slime[i]:
        nagasa -= 1
    else:
        now = slime[i]
print(nagasa)

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

fusioned_slimes = ""
prev_slime = ""
for slime in slimes:
	if slime != prev_slime:
		fusioned_slimes += slime
		prev_slime = slime

print(len(fusioned_slimes))

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

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

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

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

print(cnt+1)

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

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

ne = s[0]

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

print(len(ne))

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

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

Solution (Python):
def f(s):
    c = 0
    for i in range(len(s)):
        if i == 0:
            c = 1
        elif s[i - 1] == s[i]:
            pass
        else:
            c += 1
    return c

assert f("aabbbbaaca") == 5
assert f("aaaaa") == 1
assert f("xxzaffeeeeddfkkkkllq") == 10

_n = input()
s = input()
ans = f(s)
print(ans)

Solution (Python):
def resolve():
    _ = int(input())
    S = input()
    prev = S[0]
    cnt = 1
    for c in S[1:]:
        if prev != c:
            cnt += 1
            prev = c 
    print(cnt) 
resolve()

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

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

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

count = 0

pre = ""
for s in S:
    if pre == "":
        pre = s
        count += 1
        continue

    if pre != s:
        pre = s
        count += 1

print(count)

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

Solution (Python):
n = int(input())
list1 = list(input())
list2 = []
cout = 1
i = 0
while i < n-1:
    if list1[i] != list1[i+1]:
        cout += 1
        i += 1
    else:

        i += 1

print(cout)

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

Solution (Python):
n = int(input())
st = input()
stack = []
for i in range(n):
    if len(stack) == 0 or stack[-1] != st[i]:
        stack.append(st[i])
print(len(stack))

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

res = []
for x in s:
    if len(res) == 0:
        res.append(x)
    if res[-1] != x:
        res.append(x)

print(len(res))

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

cnt = 0
pre_slime = S[0]
for s in S[1:]:
    if pre_slime == s:
        continue
    pre_slime = s
    cnt += 1

print(cnt+1)

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

Solution (Python):






import math
import statistics
import numpy as np
import queue

n = int(input())
s = input()
ans = 1

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

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

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

ans = 0
pre = S[0]
for i in range(1, N - 1):
    if S[i] == pre:
        pass
    else:
        ans += 1
        
        pre = S[i]

if S[-1] != pre:
    ans += 2
else:
    ans += 1
print(ans)

Solution (Python):
n=int(input())
s=list(input())
cnt=0
for c,d in zip(s[0:],s[1:]):
  
  if c!=d:
    cnt+=1
  
print(cnt+1)

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

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

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

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

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

Solution (Python):
def main():
    _ = input()
    S = input()
    old = ""
    ans = 0
    for color in S:
        if color != old:
            ans += 1
        old = color
    print(ans)

if __name__ == "__main__":
    main()

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

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

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

ans = 0
x = 'X'
for s in S:
  if x != s:
    ans += 1
  x = s
  
print(ans)

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

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

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


def solve():
	if not slimes:
		print(0)
		return

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

solve()

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
S = input()
if N==1:
    print(1)
    exit()
pre = S[0]
flag = False
cnt = 1
for i in range(1,N):
    k = S[i]
    if pre==k:
        if flag:
            pass
        else:
            flag = True
    else:
        cnt += 1
        flag = False
    pre = k
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 = input()

count = 1

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

print(count)

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

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

print(ans)

Solution (Python):

"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

import numpy as np
import sys
import collections
import scipy.misc
import math
from operator import itemgetter
import itertools
import copy
import bisect
import heapq


def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]
    



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

    
def main(): 
    res = N
    now = S[0]
    for n in range(1,len(S)):
        if now == S[n]:
            res -= 1
        now = S[n]
    print(res)
                
                
                
            
            
                

    
if __name__ == '__main__':
    main()



"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())


all(nstr.count(c) for c in '753')


ABT = zip(A, B, totAB)

A, B, totAB = zip(*ABT)


(x >> i) & 1


dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break

add = 1 
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)


li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    


org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)




    for h in range(0,H):
        for w in range(0,W):
            if h == 0 and w == 0:
                pass
            elif h == 0:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h-1][W-w]+1)
            elif w == 0:   
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1)
            else:
                D[H-h-1][W-w-1]= min(D[H-h-1][W-w-1], D[H-h][W-w-1]+1, D[H-h-1][W-w]+1, D[H-h][W-w]+2)
            d_max = max(D[H-h-1][W-w-1], d_max)

"""

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

slimes = []
cur = 0
peek = 0
for i in range(n):
    if s[cur] == s[i]:
        peek = i
    else:
        slimes.append(s[cur])
        cur = i
        peek = i

slimes.append(s[cur])
print(len(slimes))

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

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

print(N-num)

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

ans = 1
prev = s[0]

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

print(ans)

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

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

print(cnt+1)

Solution (Python):
from itertools import groupby

N = int(input())
s = list(input())

ans = len([x[0] for x in groupby(s)])
print(ans)

Solution (Python):

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    s = list(input())

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

    print(len(result))


if __name__ == '__main__':
    main()

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

Solution (Python):

N = map(int, input().split())
S = list(str(input()))


if len(S)==1:
    print(1)
else:
    value=1
    tmp = S[0]
    for i in S[1:]:
        if i==tmp:
            continue
        else:
            tmp=i
            value+=1
    print(value)

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
s=input()
from itertools import groupby
print(sum(1 for k,g in groupby(s)))

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




cnt = 0
new = "-"
for c in S:
    if c == new[-1]:
        continue
    new += c
print(len(new) - 1)

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

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

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

c=0
ans=n
for i in xrange(len(s)-1):
    if s[i]==s[i+1]:
        c+=1
    else:
        ans-=c
        c=0

if c!=0:
    ans-=c

print ans

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

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

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

S_len = len(S)

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

print(S_len - d_count)

Solution (Python):
n=int(input())
a=list(map(str,input()))

tmp=a[0]
ans=1
for i in range(1,n):
  if tmp != a[i]:
    ans += 1
    tmp = a[i]

print(ans)

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    s = input()

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

    print(answer)

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

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

Solution (Python):
import sys

input = sys.stdin.readline

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

ans = 0
pre = ''
for si in S:
	if si != pre:
		ans += 1
		pre = si

print(ans)

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

prev = ''
num = 0
for c in s:
  if prev != c:
    num += 1

  prev = c

print(num)

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

cnt = 1
pre = S[0]
S2 = S[1:]
for s in S2:
    if s==pre:
        pass
    else:
        cnt += 1
        pre = s

print(cnt)

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

Solution (Python):
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N = int(input())
        S = input().rstrip()

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

        print(ans + 1)



if __name__ == '__main__':
    AtCoder().main()

Solution (Python):
import sys

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])

    types = 0
    prev_color = None

    for c in S:
        if prev_color != None and prev_color != c:
            types += 1
        prev_color = c
    types += 1
    return types


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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

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

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

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):
n = int(input())
s = list(input())
ans = len(s)
for i in range(len(s)-1):
    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]:
        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())
ans=n
s0=input()
for i in range(n-1):
    if s0[i]==s0[i+1]:
        ans-=1
print(ans)

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

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

res = 1
last = arr[0]
for i in range(1,n):
	if(arr[i] != last):
		res += 1
		last = arr[i]

print(res)

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

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

ret = 0
prev = "
i = 0

while i < len(s):
	if s[i] != prev:
		ret += 1
	prev = s[i]
	i+=1

print(ret)

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

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

Solution (Python):
N = int(input())
S = list(input())
cnt = 1
b = S[0]

for i in range(N):
    a = S[i]
    if b != a:
        cnt += 1
        b = a
        
print(cnt)

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

ans = 0
i = 0
while True:
    c = s[i]
    ans += 1
    while i < n and c == s[i]:
        i += 1
    if i == n:
        break
print(ans)

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

slimes = 0

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

print(slimes + 1)

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

from itertools import groupby
ans = len(list(groupby(s)))

print(ans)

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

count = 1
s_pre = S[0]
for s in S[1:]:
    if s_pre != s:
        count +=1
    s_pre = s

print(count)

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

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

prev = 'A'
cnt=0
for c in s:
  if c != prev:
    prev = c
    cnt += 1
    
print(cnt)

Solution (Python):
from itertools import groupby


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

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

print(len(t)+1)

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

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

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

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

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

print(len(ans))

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

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

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

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

Solution (Python):
from itertools import groupby
N = int(input())
S = input()
runlength = [len(list(v)) for k,v in groupby(S)]
print(len(runlength))

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

prev = ""
ret = 0

for i in range(len(d)):
    if prev != d[i]:
        prev = d[i]
        ret += 1

print(ret)

Solution (Python):
n = int(input())
s = list(input())
cur = s[0]
ans = 1
for i in range(1, n):
    if s[i] == cur:
        next
    else:
        ans += 1
        cur = s[i]

print(ans)

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

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

print(ans)

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

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 = input()
cnt = 0
for i in range(N-1):
  if not S[i] == S[i+1]:
    cnt += 1
print(cnt+1)

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

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

S = [i for i in S if i != 'A']
print(len(S))

Solution (Python):
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): 
    N = int(input())
    S = input()
    S +="A"
    keep = "start"
    ans = 0
    for i in S:
        if keep == "start":
            keep = i
        else:
            if keep == i:
                keep = i
            else:
                keep = i
                ans += 1
    print(ans)
                
if __name__ == "__main__":
    main()

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

ans=1
before = s[0]

for i in range(N):
	if s[i] != before:
		ans+=1
		before = 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):
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 main():
    n=int(input())
    s=list(input())
    
    ans=1
    now=s[0]
    for i in range(n):
        if s[i]==now:
            continue
        else:
            ans+=1
            now=s[i]
    print(ans)
main()

Solution (Python):
N = int(input())
S = input()
cur = ""
ans = 0
for i in S:
    if cur == i:
        continue
    ans += 1
    cur = i
print(ans)

Solution (Python):
N = int(input())
lst = list(input())
tot = 0
prev = '1'
for i in range(0,N):
    if lst[i] != prev:
        prev = lst[i]
        tot += 1
print(tot)

Solution (Python):
'''
import sys
input=sys.stdin.readline
n,m,c = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
from math import ceil
from collections import defaultdict ,Counter
'''
n = int(input())
s = input()
res = 1
t = s[0]
for i in range(1,n):
    if s[i] != s[i-1]:
        res+=1
        t = s[i]
print(res)

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

res = ''
for elem in s:
    if res == '':
        res += elem
    else:
        if res[-1] == elem:
            pass
        else:
            res += elem
print(len(res))

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

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

Solution (Python):

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
S = input()

s_pre = 'unko'
cnt = 0
for s in S:
    if s != s_pre:
        cnt += 1
        s_pre = s

print(cnt)

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

decreased = 0
prev_color = ""

for s in S:
    if s == prev_color:
        decreased += 1
    prev_color = s

print(N-decreased)

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

S = input()

ans = 0

old = "0"
for index in range(N):
    if S[index] != old:
        ans += 1
    old = S[index]

print(ans)

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

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

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

Solution (Python):
N = int(input())
S = input()
i, res = 0, 0
while i < N:
    j = i
    while j+1 < N and S[j+1] == S[i]:
        j += 1
    res += 1
    i = j+1
print(res)

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

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

ans = 1

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

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

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

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

print(N)

Solution (Python):
N=int(input())
S=list(input())
S=['0']+S
count=0
for n in range(N):
    a=S[n]
    b=S[n+1]
    count+=int(a!=b)
print(count)

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

c = ''
m = 0

for i in s:
    if c != i:
        m += 1
        c = i

print(m)

Solution (Python):
n=int(input())
s=input()
a=1
for i in range(1,n):
  if s[i]!=s[i-1]:
    a+=1
print(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):
n=int(input())
s=input()
s=s+"X"
count=0
for i in range(len(s)-1):
    if s[i]!=s[i+1]:
        count+=1
print(count)

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

temp = 'dummy'
ans = 0
for s in S:
    if s != temp:
        ans += 1
    temp = s
print(ans)

Solution (Python):
n = int(input())
s = input()
current = ""
ans = 0
for ss in s:
    if current != ss:
        ans += 1
        current = ss
    else:
        pass
print(ans)

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

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

print(ans)