codeforces global round 12 (A. Avoid Trygub) solution

Revision en1, by gourang843, 2020-12-09 10:28:23

the solution for one of the best question that i see is codeforces global round 12 A (Avoid Trygub) which accepted in first attempt and also done in python language. I solve this problem in simple way, I just move all 't' in a given string to end of the string and then problem is solved. Hope you like my solution, thankyou.

-----Solution in python language-----

t=int(input()) for i in range(t): n=int(input()) a=list(input()) if 't' in a: m=a.count('t') for i in range(m): s=a.pop(a.index('t')) a.append(s) ans='' for i in a: ans=ans+i print(ans) else: ans='' for i in a: ans=ans+i print(ans)

Tags # solution, global around 12, avoid trygub, #python 3

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English gourang843 2020-12-09 14:58:57 44
en1 English gourang843 2020-12-09 10:28:23 803 Initial revision (published)