Question and Answer from L4-M1
n = int(input().strip())
t = int(input().strip())
s = list(input().strip())
for _ in range(t):
i = 0
while i < n - 1:
if s[i] == 'B' and s[i + 1] == 'G':
s[i], s[i + 1] = s[i + 1], s[i]
i += 2 # skip next index to enforce simultaneous swaps
else:
i += 1
print("".join(s))