Asked: Sudeep |Category: Python
x=int(input("Enter the value of x : "))
for i in range(x):
n=int(input("Enter the value of n : "))
y=input("Enter the value of y : ")
l=list(y)
k=0
while(len(l)!=0):
p=[]
s=l[0]
p.append(0)
t=0
u=0
for j in l:
if(j!=s):
s=j
p.append(t)
t+=1
for j in p:
l.pop(j-u)
u=u+1
k+=1
print(k)
Comments