

N=int(eval(input()))

S=eval(input())

New=[]

for i in range(N-1):

    New.append(S[i])

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

        New.pop()

if len(New) == 0 or S[-1] != New[-1]:

    New.append(S[-1])



print((len(New)))
N=int(eval(input()))

S=eval(input())

New=[]

for i in range(N-1):

    if not S[i] == S[i+1]:

        New.append(S[i])

if len(New) == 0 or S[-1] != New[-1]:

     New.append(S[N-1])

print((len(New)))
N = int(eval(input()))
S = eval(input())
New = []
for i in range(N - 1):
    New.append(S[i])
    if S[i] == S[i + 1]:
        New.pop()
if len(New) == 0 or S[-1] != New[-1]:
    New.append(S[-1])
print((len(New)))

N = int(eval(input()))
S = eval(input())
New = []
for i in range(N - 1):
    if not S[i] == S[i + 1]:
        New.append(S[i])
if len(New) == 0 or S[-1] != New[-1]:
    New.append(S[N - 1])
print((len(New)))

-    New.append(S[i]) -    if S[i] == S[i + 1]: -        New.pop() +    if not S[i] == S[i + 1]: +        New.append(S[i]) -    New.append(S[-1]) +    New.append(S[N - 1])