I wrote code for the following problem:
Given a string, print out the number of deletions required so that the adjacent alphabets are distinct.
Please suggest different methods by which I can increase the speed of execution.
tst = int(input())
for i in range(0,tst):
str = input()
length = len(str)
str = list(str)
j=0;
count = 0
while(j<length):
if(j+1<length):
if((str[j] == str[j+1])):
del str[j+1]
count+=1
length-=1
else:
j+=1
else:
j+=1
print(count)