gourang843's blog

By gourang843, history, 4 years ago, In English

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-----100547323 ~~~~~ 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)

~~~~~

  • Vote: I like it
  • -37
  • Vote: I do not like it

| Write comment?