n = int(eval(input()))

s = eval(input())

ans = []

i = 0

while i != n:

    cnt = 1

    for j in range(i+1,n):

        if s[i] == s[j]:

            cnt+=1

        else:

            break

    ans.append(s[i])

    if cnt>=2:

        i+=cnt

    else:

        i+=1



print((len(ans)))



        
n = int(eval(input()))

s = eval(input())

ans = [s[0]]

for i in range(n-1):

    if s[i]!= s[i+1]:

        ans.append(s[i+1])

print((len(ans)))
n = int(eval(input()))
s = eval(input())
ans = []
i = 0
while i != n:
    cnt = 1
    for j in range(i + 1, n):
        if s[i] == s[j]:
            cnt += 1
        else:
            break
    ans.append(s[i])
    if cnt >= 2:
        i += cnt
    else:
        i += 1
print((len(ans)))

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

-ans = [] -i = 0 -while i != n: -    cnt = 1 -    for j in range(i + 1, n): -        if s[i] == s[j]: -            cnt += 1 -        else: -            break -    ans.append(s[i]) -    if cnt >= 2: -        i += cnt -    else: -        i += 1 +ans = [s[0]] +for i in range(n - 1): +    if s[i] != s[i + 1]: +        ans.append(s[i + 1])