eval(input())

S=eval(input())



while True:

 x=''

 ans=''

 for i in S:

   if (x==''):

    x=i

    continue

   if x!=i:

    ans+=x

    x=i

 ans+=x

 if ans==S:

   break

 else:

   S=ans

print((len(ans)))       
eval(input())

S=eval(input())



l=S[0]

c=1

for i in S[1:]:

 if l!=i:

  c+=1

  l=i

print(c)
eval(input())
S = eval(input())
while True:
    x = ""
    ans = ""
    for i in S:
        if x == "":
            x = i
            continue
        if x != i:
            ans += x
            x = i
    ans += x
    if ans == S:
        break
    else:
        S = ans
print((len(ans)))

eval(input())
S = eval(input())
l = S[0]
c = 1
for i in S[1:]:
    if l != i:
        c += 1
        l = i
print(c)

-while True: -    x = "" -    ans = "" -    for i in S: -        if x == "": -            x = i -            continue -        if x != i: -            ans += x -            x = i -    ans += x -    if ans == S: -        break -    else: -        S = ans -print((len(ans))) +l = S[0] +c = 1 +for i in S[1:]: +    if l != i: +        c += 1 +        l = i +print(c)