Farewell Round A 2023. Task 5
Python Only
T=int(input())
for t in range(T):
C=input()
if len(set(C))==1:
count=len(C)//2+len(C)%2
else:
while C[0]==C[-1]:
C=C[1:]+C[0]
count=C.count('PP')+C.count('SS')+C.count('RR')
print('Case #{}: {}'.format((t+1),count))