During the break the schoolchildren, boys and girls, formed a queue of n people in the canteen. Initially the children stood in the order they entered the canteen. However, after a while the boys started feeling awkward for standing in front of the girls in the queue and they started letting the girls move forward each second. 

Let's describe the process more precisely. Let's say that the positions in the queue are sequentially numbered by integers from 1 to n, at that the person in the position number 1 is served first. Then, if at time x a boy stands on the i-th position and a girl stands on the (i + 1)-th position, then at time x + 1 the i-th position will have a girl and the (i + 1)-th position will have a boy. The time is given in seconds.

You've got the initial position of the children, at the initial moment of time. Determine the way the queue is going to look after t seconds.


-----Input-----

The first line contains two integers n and t (1 ≤ n, t ≤ 50), which represent the number of children in the queue and the time after which the queue will transform into the arrangement you need to find. 

The next line contains string s, which represents the schoolchildren's initial arrangement. If the i-th position in the queue contains a boy, then the i-th character of string s equals "B", otherwise the i-th character equals "G".


-----Output-----

Print string a, which describes the arrangement after t seconds. If the i-th position has a boy after the needed time, then the i-th character a must equal "B", otherwise it must equal "G".


-----Examples-----
Input
5 1
BGGBG

Output
GBGGB

Input
5 2
BGGBG

Output
GGBGB

Input
4 1
GGGB

Output
GGGB

Difficulty: EASY
Tags: Flows and cuts

Shortest paths

Implementation

Constructive algorithms

Starter code:

Solutions:
(n, t) = map(int, input().split())
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
stroka = input()
for i in range(b):
	x = 0
	while x < len(stroka) - 1:
		if stroka[x] == 'B' and stroka[x + 1] == 'G':
			stroka = stroka[:x + 1] + 'B' + stroka[x + 2:]
			stroka = stroka[:x] + 'G' + stroka[x + 1:]
			x += 1
		x += 1
print(stroka)


(a, b) = map(int, input('').split())
d = input('')
for i in range(b):
	d = d.replace('BG', 'GB')
print(d)


(n, k) = map(int, input().split())
s = list(input())
for _ in range(k):
	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 += 1
		i += 1
print(''.join(s))


(n, t) = input().strip().split(' ')
(n, t) = (int(n), int(t))
s = input().strip()
q = list(s)
for _ in range(t):
	i = 0
	while i < len(q) - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			i = i + 1
		i = i + 1
print(''.join(q))


def main():
	(n, t) = map(int, input().split())
	s = [c for c in input()]
	while t > 0:
		(t, i) = (t - 1, 0)
		while i < len(s) - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = ('G', 'B')
				i += 2
			else:
				i += 1
	print(''.join(s))
main()


q = input()
n = int(q.split()[0])
t = int(q.split()[1])
l = list(input())
z = list(l)
for i in range(t):
	for j in range(1, n):
		if l[j] == 'G' and l[j - 1] == 'B':
			(z[j], z[j - 1]) = (z[j - 1], z[j])
	l = list(z)
for i in l:
	print(i, end='')
print()


x = input().split()
y = input()
m = int(x[1])
for i in y:
	if i == 'B':
		while m != 0:
			y = y.replace('BG', 'GB')
			m = m - 1
print(y)


t = int(input()[2:])
strr = input()
while t:
	strr = strr.replace('BG', 'GB')
	t -= 1
print(strr)


(n, t) = input().split()
a = list(input())
for j in range(int(t)):
	i = 0
	while i < len(a) - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = ('G', 'B')
			i += 1
		i += 1
print(''.join(a))


number = input().split(' ')
n = number[0]
t = int(number[1])
defolt_str = input() + ' '
new_str = ''
for i in range(t):
	flag = False
	for j in range(len(defolt_str) - 1):
		if flag:
			flag = False
			continue
		if defolt_str[j] == 'B' and defolt_str[j + 1] == 'G':
			new_str += 'GB'
			flag = True
		else:
			new_str += defolt_str[j]
	defolt_str = new_str + ' '
	new_str = ''
print(defolt_str)


(n, t) = map(int, input().split())
st = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if st[j] == 'B' and st[j + 1] == 'G':
			(st[j], st[j + 1]) = (st[j + 1], st[j])
			j += 1
		j += 1
print(''.join(st))


(n, t) = map(int, input().split())
l = list(input())
while t:
	t -= 1
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
print(''.join(l))


(n, m) = map(int, input().split())
l = list(input())
for _ in range(m):
	i = 1
	while i < n:
		if l[i] == 'G' and l[i - 1] == 'B':
			(l[i], l[i - 1]) = (l[i - 1], l[i])
			i += 1
		i += 1
print(''.join(l))


line = input().split()
n = int(line[0])
t = int(line[1])
string = list(input())
for i in range(t):
	new = []
	j = 0
	while j < n:
		if j < n - 1:
			if string[j] == 'B' and string[j + 1] == 'G':
				new.append('G')
				new.append('B')
				j += 2
			else:
				new.append(string[j])
				j += 1
		else:
			new.append(string[j])
			j += 1
	string = new
s = ''
for i in range(n):
	s += string[i]
print(s)


(n, t) = map(int, input().split())
s = input()

def step(q):
	i = 0
	r = []
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			r.append('G')
			r.append('B')
			i += 2
		else:
			r.append(q[i])
			i += 1
	if i == n - 1:
		r.append(q[n - 1])
	return r
for _ in range(t):
	s = step(s)
print(''.join(s))


(n, t) = input().split(' ')
s = input()
ns = ''
for i in range(int(t)):
	j = 0
	while j <= int(n) - 1:
		if j < int(n) - 1 and (s[j] == 'B' and s[j + 1] == 'G'):
			ns = ns + s[j + 1] + s[j]
			j += 1
		else:
			ns = ns + s[j]
		j += 1
	s = ns
	ns = ''
print(s)


(n, k) = map(int, input().split())
a = list(input())
while k > 0:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i + 1] = 'B'
			a[i] = 'G'
			i += 2
		else:
			i += 1
	k -= 1
s = ''
for i in range(len(a)):
	s += a[i]
print(s)


(n, t) = map(int, input().split())
a1 = list(input())
a2 = a1.copy()
for _ in range(t):
	for i in range(n):
		a2[i] = a1[i]
	for i in range(n - 1):
		if a1[i] == 'B' and a1[i + 1] == 'G':
			a2[i] = 'G'
			a2[i + 1] = 'B'
	(a1, a2) = (a2, a1)
print(''.join(a1))


(students, sec) = map(int, input().split())
queue = list(input())
for i in range(sec):
	j = 0
	while j < students - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			queue[j] = 'G'
			queue[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(queue))


(n, t) = map(int, input().split())
q = input()
a = []
for (i, x) in enumerate(q):
	a.append(x)
for i in range(t):
	k = 0
	for i in range(n):
		if k > n - 2:
			break
		if a[k] == 'B' and a[k + 1] == 'G':
			a[k] = 'G'
			a[k + 1] = 'B'
			k += 2
		else:
			k += 1
for (i, x) in enumerate(a):
	print(x, end='')


ID = input().split()
n = int(ID[0])
k = int(ID[1])
s = input()
t = ''
for _ in range(k):
	i = 0
	while i < n:
		if i == n - 1:
			t += s[i]
		elif s[i] == 'B' and s[i + 1] == 'G':
			t += s[i + 1] + s[i]
			i += 1
		else:
			t += s[i]
		i += 1
	s = t
	t = ''
print(s)


(_, t) = map(int, input().split(' '))
s = input()
for _ in range(t):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s = s[:i] + 'GB' + s[i + 2:]
			i += 1
		i += 1
print(s)


n = input()[2:]
k = input()
for i in range(int(n)):
	k = k.replace('BG', 'GB')
print(k)


t = int(input()[2:])
s = input()
for i in range(0, t):
	s = s.replace('BG', 'GB')
print(s)


(n, k) = map(int, input().split())
s = input()
for _ in range(k):
	if 'BG' in s:
		s = s.replace('BG', 'GB')
print(s)


from sys import stdin

def sin():
	return stdin.readline()
(n, t) = map(int, sin().split())
s = list(input())
for i in range(t):
	e = []
	for j in range(1, n):
		if s[j - 1] == 'B' and s[j] == 'G':
			e.append(j)
	for j in e:
		(s[j], s[j - 1]) = (s[j - 1], s[j])
print(''.join(s))


queue = input()
queue = queue.split(' ')
queue = list(map(int, queue))
time = int(queue[1])
line = input()
line = list(line)
line_new = list(line)
for i in range(0, time):
	for j in range(1, len(line)):
		if line[j] == 'G' and line[j - 1] == 'B':
			temp = line_new[j]
			line_new[j] = line_new[j - 1]
			line_new[j - 1] = temp
	line = list(line_new)
print(''.join(line))


(x, q) = [int(i) for i in input().split(' ')]
queue = str(input())
for j in range(q):
	queue = queue.replace('BG', 'GB')
print(queue)


(N, t) = tuple(map(int, input().split()))
queue = list(input())
for _ in range(t):
	i = 1
	while i < N:
		if queue[i] == 'G' and queue[i - 1] == 'B':
			(queue[i], queue[i - 1]) = ('B', 'G')
			i += 1
		i += 1
print(''.join(queue))


def ans(s):
	return s.replace('BG', 'GB')
(a, b) = map(int, input().split())
s = str(input())
x = ''
while b > 0:
	x = ans(s)
	s = x
	b -= 1
print(s)


import re
(n, t) = [int(x) for x in input().split()]
seq = input()
s = seq
seq = list(seq)
while t != 0:
	i = 1
	while i < len(seq):
		if seq[i] == 'G' and seq[i - 1] == 'B':
			seq[i] = 'B'
			seq[i - 1] = 'G'
			i += 2
		else:
			i += 1
	t -= 1
print(*seq, sep='')


nt = list(input().split())
n = int(nt[0])
t = int(nt[1])
s = input()
a = [0] * (t + 1)
a[0] = s
for i in range(1, t + 1):
	a[i] = a[i - 1].replace('BG', 'GB')
print(a[t])


(n, t) = map(int, input().split())
q = list(input())
i = 0
for i in range(0, t):
	j = 0
	while j < n - 1:
		if q[j] == 'B' and q[j + 1] == 'G':
			(q[j], q[j + 1]) = (q[j + 1], q[j])
			j = j + 2
		else:
			j += 1
	i += 1
q_new = ''.join(q)
print(q_new)


(_, s) = map(int, input().split())
lista = input()
while s > 0:
	lista = lista.replace('BG', 'GB')
	s -= 1
print(lista)


(A, B) = map(int, input().split())
s = list(input())
m = 0
while m < B:
	i = 0
	while i < A - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
	m += 1
k = ''.join(s)
print(k)


(l, t) = [int(z) for z in input().split()]
seq = input()
for y in range(t):
	seq = seq.replace('BG', 'GB')
print(seq)


(initial_pos, x) = map(int, input().split())
t = list(input())
for itr in range(x):
	for (p, n, i) in zip(t[len(t) - 2::-1], t[len(t) - 1:0:-1], range(len(t) - 1, -1, -1)):
		if p == 'B' and n == 'G':
			t[i - 1] = n
			t[i] = p
print(''.join(t))


(num_child, time) = map(int, input().split(' '))
inp = input()
queue_string = list(inp)
for t in range(time):
	i = 0
	while i < num_child - 1:
		if queue_string[i] == 'B' and queue_string[i + 1] == 'G':
			queue_string[i + 1] = 'B'
			queue_string[i] = 'G'
			i += 2
		else:
			i += 1
op = ''.join(queue_string)
print(op)


(n, d) = input().split()
n = int(n)
d = int(d)
st = input()
c = 0
for i in range(d):
	j = 1
	while j < n:
		if st[j - 1] == 'B' and st[j] == 'G':
			st = st[:j - 1] + 'GB' + st[j + 1:]
			j += 2
		else:
			j += 1
print(st)


(n, t) = map(int, input().split())
s = input()
while t > 0:
	s = s.replace('BG', 'GB')
	t = t - 1
print(s)


(n, t) = (int(x) for x in input().split())
s = list(input().strip())
start = 0
for i in range(t):
	j = start
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(s))


(n, t) = [int(i) for i in input().split()]
line = list(input())
for i in range(t):
	k = n
	for j in range(n):
		if j == k or j == n - 1:
			continue
		elif line[j] == 'B' and line[j + 1] == 'G':
			line[j] = 'G'
			line[j + 1] = 'B'
			k = j + 1
print(''.join(line))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
queue = input()
for i in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


import sys
(n, t) = [int(el) for el in sys.stdin.readline().strip().split()]
s = list(sys.stdin.readline().strip())
for _ in range(t):
	index = 0
	while index < n - 1:
		el = s[index]
		if el == 'B' and s[index + 1] == 'G':
			s[index] = 'G'
			s[index + 1] = 'B'
			index += 2
		else:
			index += 1
print(''.join(s))


(n, t) = [int(x) for x in input().split()]
q = input()
for i in range(t):
	q = q.replace('BG', 'GB')
print(q)


(n, t) = map(int, input().split()[:2])
s = list(input()[:n])

def arr(s):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
	return s
for i in range(t):
	s = arr(s)
s = ''.join(s)
print(s)


(n, t) = (int(x) for x in input().split())
s = input()
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s = s[:j] + 'GB' + (s[j + 2:] if j + 2 < n else '')
			j += 2
		else:
			j += 1
print(s)


(l, t) = map(int, input().split())
s = str(input())
a = list(s)
for j in range(t):
	i = 0
	while i < l - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i = i + 1
		i += 1
print(''.join(a))


(n, t) = input().split()
queue = list(input())
n = int(n)
t = int(t)
while t > 0:
	ind = len(queue) - 1
	while ind > 0:
		if queue[ind] == 'G' and queue[ind - 1] == 'B':
			queue[ind] = 'B'
			queue[ind - 1] = 'G'
			ind -= 2
		else:
			ind -= 1
	t = t - 1
print(''.join(queue))


(l, t) = map(int, input().split())
A = list(input())
for k in range(t):
	i = 0
	while i < l - 1:
		if A[i] == 'B' and A[i + 1] == 'G':
			temp = A[i]
			A[i] = A[i + 1]
			A[i + 1] = temp
			i += 2
		else:
			i += 1
print(''.join(A))


x = [0, 0]
x = input().split()
x[0] = int(x[0])
x[1] = int(x[1])
n = input()
p = []
for i in range(0, x[0]):
	p.append(n[i])
for i in range(0, x[1]):
	j = 1
	while j < x[0]:
		if p[j - 1] == 'B' and p[j] == 'G':
			(p[j], p[j - 1]) = (p[j - 1], p[j])
			j += 1
		j += 1
for i in range(0, x[0]):
	print(p[i], end='')


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
w = -1
list1 = [s[i] for i in range(len(s))]
for i in range(k):
	for j in range(n):
		if j < n - 1 and list1[j] == 'B' and (j != w):
			if list1[j + 1] == 'G':
				list1[j] = 'G'
				list1[j + 1] = 'B'
				w = j + 1
	w = -1
print(''.join(list1))


(n, t) = list(map(int, input().split()))
s = list(input())
for i in range(t):
	ind = 1
	while ind < len(s):
		if s[ind - 1] == 'B' and s[ind] == 'G':
			(s[ind - 1], s[ind]) = (s[ind], s[ind - 1])
			ind += 2
		else:
			ind += 1
print(''.join(s))


(n, t) = map(int, input().split())
l = input()

def turn(l):
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l = l[:i] + 'GB' + l[i + 2:]
			i += 2
		else:
			i += 1
	return l
k = 0
while k < t:
	l = turn(l)
	k += 1
print(l)


def main():
	(k, n) = map(int, input().split())
	line = list(input())
	for _ in range(n):
		j = 0
		while j < k - 1:
			if line[j] == 'B' and line[j + 1] == 'G':
				(line[j], line[j + 1]) = ('G', 'B')
				j += 2
			else:
				j += 1
	print(''.join(line))
main()


def main():
	from sys import stdout
	(n, t) = map(int, input().split())
	line = input()
	new_line = line
	if n != 1:
		for i in range(t):
			line = new_line
			new_line = ''
			pass_ = False
			for ind in range(len(line) - 1):
				if pass_:
					if ind == len(line) - 2:
						new_line += line[ind + 1]
					pass_ = False
				elif line[ind] == 'B' and line[ind + 1] == 'G':
					new_line += 'GB'
					pass_ = True
				elif ind == len(line) - 2:
					new_line += line[ind] + line[ind + 1]
				else:
					new_line += line[ind]
	else:
		new_line = line
	stdout.write(new_line)
main()


def rep(s):
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			return s.replace('BG', 'GB')
	return s

def func():
	(n, t) = input().split(' ')
	string = input()
	(en, tee) = (int(n), int(t))
	for i in range(tee):
		string = rep(string)
	return string
print(func())


def queueAtSchool():
	s = input().split()
	(n, t) = (int(s[0]), int(s[1]))
	s1 = input()
	l = [s1[i:i + 1] for i in range(n)]
	while t > 0:
		i = 0
		while i < n:
			if i < n - 1:
				if l[i] == 'B' and l[i + 1] == 'G':
					(l[i], l[i + 1]) = (l[i + 1], l[i])
					i = i + 2
				else:
					i = i + 1
			else:
				i = i + 1
		t = t - 1
	s2 = ''.join(l)
	print(s2)
queueAtSchool()


(n, t) = map(int, input().split())
lst = str(input())
while t > 0:
	lst = lst.replace('BG', 'GB')
	t -= 1
print(lst)


from sys import stdin
num1 = list(map(int, stdin.readline().split()))
num = num1[1]
num = int(num)
result = stdin.readline()
for i in range(num):
	result = result.replace('BG', 'GB')
print(result)


(n, t) = list(map(int, input().split()))
s = input()
for i in range(t):
	A = [0] * n
	for j in range(1, n):
		if s[j] == 'G' and s[j - 1] == 'B':
			A[j] = 1
	for j in range(1, n):
		if A[j] == 1:
			s = s[:j - 1] + s[j] + s[j - 1] + s[j + 1:]
print(s)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	if 'BG' in s:
		x = s.count('BG')
		s = s.replace('BG', 'GB')
print(s)


firststring = input()
lis = firststring.split()
length = len(lis)
entry = int(lis[0])
time = int(lis[1])
rowstring = input()
lisstring = []
for i in rowstring:
	lisstring.append(i)
for i in range(time):
	j = 0
	while j < len(lisstring) - 1:
		if lisstring[j] == 'B' and lisstring[j + 1] == 'G':
			(lisstring[j], lisstring[j + 1]) = (lisstring[j + 1], lisstring[j])
			j = j + 2
		else:
			j = j + 1
for i in lisstring:
	print(i, end='')


x = [int(i) for i in input().split()]
n = x[0]
t = x[1]
queue = [i for i in input()]
for i in range(t):
	j = 0
	while j < len(queue) - 1:
		if queue[j] != queue[j + 1] and queue[j] == 'B':
			(queue[j], queue[j + 1]) = (queue[j + 1], queue[j])
			j += 2
			continue
		j += 1
print(*queue, sep='')


import sys
(n, m) = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().strip()
for i in range(m):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = [int(i) for i in input().split()]
line = list(input())
arr_B = []
for i in range(n - 1):
	if line[i] == 'B':
		arr_B.append(i)
for x in range(t):
	for i in arr_B:
		if i + 1 <= len(line) - 1:
			if line[i + 1] == 'G':
				line.pop(i)
				line.insert(i + 1, 'B')
				arr_B[arr_B.index(i)] += 1
new_line = ''.join(line)
print(new_line)


l = list(map(int, input().split()))
li = list(input())
for i in range(l[1]):
	j = 1
	while j < l[0]:
		if li[j - 1] == 'B' and li[j] == 'G':
			(li[j - 1], li[j]) = (li[j], li[j - 1])
			j += 1
		j += 1
print(''.join(li))


(n, t) = [int(x) for x in input().split()]
s = input()
a = s
for i in range(t):
	a = a.replace('BG', 'GB')
print(a)


n = list(map(int, input().split(' ')))
c = list(input())
d = c[:]
for j in range(0, n[1]):
	for i in range(0, n[0] - 1):
		if c[i] == 'B' and c[i + 1] == 'G':
			d[i] = c[i + 1]
			d[i + 1] = c[i]
	c = d[:]
print(''.join(d))


(t, s) = (int(input().split()[1]), input())
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


def solve():
	(n, t) = [int(s) for s in input().split()]
	s = input()
	ans = str()
	for i in range(t):
		j = 0
		while j < n:
			if j + 1 < n and s[j] is 'B' and (s[j + 1] is 'G'):
				ans += 'GB'
				j += 1
			else:
				ans += s[j]
			j += 1
		s = ans
		ans = str()
	print(s)
solve()


s = input().strip().split()
n = int(s[0])
t = int(s[1])
q = input().strip()
x = []
f = 0
for i in q:
	x.append(i)
for c in range(0, t):
	for d in range(0, len(x) - 1):
		if x[d] == 'B' and x[d + 1] == 'G' and (f == 0):
			(x[d], x[d + 1]) = (x[d + 1], x[d])
			if d != len(x) - 2:
				f = 1
		else:
			f = 0
for j in range(0, len(x)):
	print(x[j], end='')


(n, t) = map(int, input().split())
s = input()
l = list(s)
le = len(l)
for j in range(t):
	i = 0
	while i < le and i + 1 < le:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i = i + 2
		else:
			i = i + 1
	s1 = ''.join(l)
print(s1)


(n, t) = map(int, input().split())
queue = input()
list = []
for i in range(n):
	list.append(queue[i])
a = []
i = 0
p = 0
while p < t:
	while i < n:
		if i < n - 1 and list[i] == 'B' and (list[i + 1] == 'G'):
			a.append(list[i + 1])
			a.append(list[i])
			i += 2
		elif i == n - 1 and list[i - 1] == 'G':
			a.append(list[i])
			i += 1
		else:
			a.append(list[i])
			i += 1
	list = a[:]
	if p < t - 1:
		a = []
	else:
		pass
	p += 1
	i = 0
for i in list:
	print(i, end='')


(n, k) = map(int, input().split())
s = input()
l = []
for i in range(len(s)):
	l.append(s[i])
for i in range(k):
	j = 0
	while j < n - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			l[j] = 'G'
			l[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(l))


n_time = input()
(n, time) = n_time.split()
(n, time) = (int(n), int(time))
s = input()
s = list(s)
for t in range(time):
	y = []
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			y.append(i)
	for k in range(len(y)):
		(s[y[k]], s[y[k] + 1]) = (s[y[k] + 1], s[y[k]])
_string = ''
for j in range(len(s)):
	_string += s[j]
print(_string)


(n, k) = map(int, input().split())
t = input()
inn = []
for x in range(n):
	if t[x] == 'B':
		inn.append(x)
m = len(inn)
t = t + '0'
t = list(t)
for x in range(k):
	for y in range(m):
		if t[inn[y] + 1] == 'G':
			t[inn[y]] = 'G'
			t[inn[y] + 1] = 'B'
			inn[y] = inn[y] + 1
print(''.join(t[:n]))


(n, t) = input().split()
s = list(input())
n = int(n)
t = int(t)
i = 0
for x in range(t):
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
	i = 0
s = ''.join(s)
print(s)


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	ind = []
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			ind.append(i)
	for i in ind:
		(s[i], s[i + 1]) = (s[i + 1], s[i])
print(*s, sep='')


(n, t) = map(int, input().split())
s = input()
while t:
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s = s[:i] + 'GB' + s[i + 2:]
			i = i + 1
		i = i + 1
	t = t - 1
print(s)


childernTime = input()
childernTime = childernTime.rsplit(' ')
line = list(input())
for j in range(int(childernTime[1])):
	ex = 1
	while ex < int(childernTime[0]):
		if line[ex] == 'G' and line[ex - 1] == 'B':
			line[ex - 1] = 'G'
			line[ex] = 'B'
			ex = ex + 1
		ex = ex + 1
print(''.join(map(str, line)))


(n, t) = map(int, input().split())
sequence = input()
while t:
	sequence = sequence.replace('BG', 'GB')
	t -= 1
print(sequence)


s = input().split()
a = int(s[0])
b = int(s[1])
S = input()
i = 1
while i <= b:
	j = 0
	while j <= a - 2:
		if S[j] == 'B' and S[j + 1] == 'G':
			S = S[:j] + 'G' + 'B' + S[j + 2:]
			j = j + 2
		else:
			j = j + 1
	i = i + 1
print(S)


(n, t) = [int(p) for p in input().split()]
que = list(str(input()))
k = 0
for j in range(t):
	k = 0
	for i in range(n - 1):
		if k == 0:
			if que[i] == 'B' and que[i + 1] == 'G':
				que[i] = 'G'
				que[i + 1] = 'B'
				k = 1
				continue
		if k == 1:
			k = 0
			continue
print(''.join(que))


(n, t) = map(int, input().split())
s = input()
st = s
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			if j == 0:
				st = s[j + 1] + s[j] + s[j + 2:]
				j += 1
			else:
				st = st[0:j] + s[j + 1] + s[j] + s[j + 2:]
				j += 1
		j += 1
	s = st
print(st)


(length, time) = input().split()
queue = input()
for i in range(int(time)):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, s) = list(map(int, input().split()))
k = list(input())
for i in range(s):
	j = 0
	while j < n - 1:
		if k[j] == 'B' and k[j + 1] == 'G':
			k[j] = 'G'
			k[j + 1] = 'B'
			j = j + 1
		j = j + 1
for i in k:
	print(i, end='')


(n, t) = map(int, input().split())
s = list(input(''))
for g in range(t):
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i = i + 2
		else:
			i += 1
for x in s:
	print(x, end='')


(n, t) = [int(x) for x in input().strip().split()]
q = list(input().strip())
for _ in range(t):
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
			continue
print(''.join(q))


data = input().split()
seconds = int(data[1])
string = input()
dummy = []
while seconds > 0:
	for i in range(2, len(string) + 1):
		if string[i - 2:i] == 'BG':
			dummy.append(i - 2)
	string = list(string)
	for i in range(0, len(dummy)):
		(string[dummy[i]], string[dummy[i] + 1]) = (string[dummy[i] + 1], string[dummy[i]])
	string = ''.join(string)
	dummy = []
	seconds -= 1
print(''.join(string))


(n, t) = [int(x) for x in input().split()]
a = input()
if 'BG' not in a:
	print(a)
else:
	while True:
		bg = a.count('BG')
		a = a.replace('BG', 'GB')
		t -= 1
		if t == 0:
			print(a)
			break


try:
	(N, T) = map(int, input().split())
	s = input()
	l = list(s)
	temp = 0
	for j in range(T):
		for i in range(N - 1):
			if temp > 0:
				temp = 0
				continue
			if l[i] == 'B' and l[i + 1] == 'G':
				l[i] = 'G'
				l[i + 1] = 'B'
				temp += 1
			if i + 1 == N - 1:
				temp = 0
				break
	s = ''
	for ele in l:
		s += ele
	print(s)
except:
	pass


data = input()
input_process = data.split(' ')
n = int(input_process[0])
t = int(input_process[1])
count = 0
queue_input = input()
queue = queue_input[0:n]
while count < t:
	queue = queue.replace('BG', 'GB')
	count += 1
print(queue)


(n, t) = map(int, input().split())
s = list(input())
while t > 0:
	i = 1
	while i < n:
		curr = s[i]
		if curr == 'G' and s[i - 1] == 'B':
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			i += 1
		i += 1
	t -= 1
ans = ''
for i in s:
	ans += i
print(ans)


x = input().split()
n = int(x[0])
t = int(x[1])
queue = input()
for j in range(t):
	i = 0
	s = ''
	while i < n - 1:
		if queue[i] + queue[i + 1] == 'BG':
			s += 'GB'
			i += 2
		else:
			s += queue[i]
			i += 1
	if i == n - 1:
		s += queue[n - 1]
	queue = s
print(queue)


a = input()
no_of_people = []
(no_of_peoples, time) = a.split(' ')
(no_of_peoples, time) = (int(no_of_peoples), int(time))
peoples = input()
length = len(peoples)
for i in range(length):
	no_of_people.append(peoples[i])
while time > 0:
	j = 0
	while j < len(no_of_people) - 1:
		if no_of_people[j] == 'B' and no_of_people[j + 1] == 'G':
			(no_of_people[j], no_of_people[j + 1]) = (no_of_people[j + 1], no_of_people[j])
			j += 2
		else:
			j += 1
	time -= 1
for item in no_of_people:
	print(item, end='')


(n, t) = map(int, input().split())
a = input()
j = 1
while j <= t:
	j = j + 1
	i = 1
	while i < n:
		if a[i] == 'G' and a[i - 1] == 'B':
			a = a[:i - 1] + 'GB' + a[i + 1:]
			i = i + 2
		else:
			i = i + 1
print(a)


seconds = int(input().split(' ')[1])
line = list(input())
for j in range(seconds):
	spot = 0
	while spot < len(line) - 1:
		if line[spot] == 'B' and line[spot + 1] == 'G':
			(line[spot], line[spot + 1]) = (line[spot + 1], line[spot])
			spot += 2
		else:
			spot += 1
print(''.join(line))


n = list(map(int, input().split()))
s = input()
for i in range(n[1]):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
queue = input()
queue_list = list(queue)
for i in range(t):
	i = 0
	while i < n - 1:
		if queue_list[i] == 'B' and queue_list[i + 1] == 'G':
			queue_list[i] = 'G'
			queue_list[i + 1] = 'B'
			i += 2
		else:
			i += 1
result = ''.join(queue_list)
print(result)


(n, t) = map(int, input().split())
a = input()
for j in range(t):
	a = a.replace('BG', 'GB', a.count('BG'))
print(''.join(a))


(siz, x) = map(int, input().split())
s = input()
lis = [i for i in s]
for _ in range(x):
	i = 0
	while i < siz - 1:
		if lis[i] == 'B' and lis[i + 1] == 'G':
			(lis[i], lis[i + 1]) = (lis[i + 1], lis[i])
			i += 1
		i += 1
print(''.join((i for i in lis)))


(n, t) = map(int, input().split())
order1 = input()
order = []
for i in order1:
	order.append(i)
for j in range(t):
	i = 0
	while i < n - 1:
		if order[i] == 'B' and order[i + 1] == 'G':
			temp = order[i]
			order[i] = order[i + 1]
			order[i + 1] = temp
			i = i + 2
		else:
			i = i + 1
print(''.join(order))


(m, n) = [int(x) for x in input().split()]
strp = input()
str = 'GB'
for i in range(n):
	strplst = strp.split('BG')
	strp = str.join(strplst)
print(strp)


def read_int_row():
	return [int(x) for x in input().split()]

def shift(q):
	out = ''
	q_len = len(q)
	i = 0
	while i < q_len:
		if q[i] == 'G':
			out += 'G'
			i += 1
			continue
		elif q[i] == 'B' and i + 1 < q_len and (q[i + 1] == 'G'):
			out += 'GB'
			i += 2
			continue
		else:
			out += 'B'
			i += 1
			continue
	return out
(_, t) = read_int_row()
q = input()
for _ in range(t):
	q = shift(q)
print(q)


(size, swap) = map(int, input().split())
qu = list(input())
for i in range(swap):
	x = 0
	while x < size - 1:
		if qu[x] == 'B' and qu[x + 1] == 'G':
			(qu[x], qu[x + 1]) = (qu[x + 1], qu[x])
			x += 1
		x += 1
for x in range(len(qu)):
	print(qu[x], end='')


(n, t) = map(int, input().split())
seq = input()
seq1 = ''
lst = []
lst1 = []
for ele in seq:
	lst.append(ele)
lst1 = lst.copy()
for M in range(0, t):
	for i in range(0, len(lst) - 1):
		if lst[i] == 'B' and lst[i + 1] == 'G':
			lst1[i] = 'G'
			lst1[i + 1] = 'B'
	lst = lst1.copy()
for ele1 in lst1:
	seq1 += ele1
print(seq1)


(n, t) = [int(z) for z in input().split()]
a = str(input())
a = list(a)
for _ in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i += 2
		else:
			i += 1
a = ''.join(a)
print(a)


(a, b) = map(int, input().split())
c = input('')
for i in range(b):
	if 'BG' in c:
		c = c.replace('BG', 'GB')
print(c)


(m, t) = map(int, input().split())
l = input()
while t != 0:
	t -= 1
	s = ''
	i = 0
	while i < len(l):
		if i < len(l) - 1:
			if l[i] == 'B' and l[i + 1] == 'G':
				s += 'G'
				s += 'B'
				i += 2
				continue
		s += l[i]
		i += 1
	l = s
print(l)


import re
(n, x) = map(int, input().split())
line = input()
pattern = 'BG'
for i in range(x):
	line = re.sub(pattern, 'GB', line)
print(line)


(n, l) = input().split()
n = [i for i in input()]
i = 0
while i < int(l):
	j = 0
	while j < len(n) - 1:
		if n[j] < n[j + 1]:
			(n[j], n[j + 1]) = (n[j + 1], n[j])
			j += 1
		j += 1
	i += 1
print(''.join(n))


(n, t) = map(int, input().split())
s = input()
s = list(s)
s.append('0')
for i in range(t):
	x = 0
	while x != len(s) - 1:
		if s[x] == s[x + 1]:
			x = x + 1
		elif s[x] == 'G' and s[x + 1] == 'B':
			x = x + 1
		elif s[x] == 'B' and s[x + 1] == 'G':
			s[x] = 'G'
			s[x + 1] = 'B'
			x = x + 2
		else:
			x = len(s) - 1
s.pop(len(s) - 1)
listToStr = ''.join(map(str, s))
print(listToStr)


(n, t) = map(int, input().split())
queue = list(input())
final_queue = queue[:]
equilibrium = False
for _ in range(t):
	if equilibrium:
		break
	equilibrium = True
	for i in range(n - 1, 0, -1):
		if queue[i] == 'G' and queue[i - 1] == 'B':
			(final_queue[i], final_queue[i - 1]) = (final_queue[i - 1], final_queue[i])
			equilibrium = False
	queue = final_queue[:]
print(''.join(final_queue))


c = [int(x) for x in input().split()]
s = str(input())
s = list(s)

def M(s):
	k = 0
	while k < len(s) - 1:
		if s[k] == 'B' and s[k + 1] == 'G':
			s[k] = s[k + 1]
			s[k + 1] = 'B'
			k += 1
		k += 1
	return s
for k in range(c[1]):
	s = M(s)
g = ''
for k in range(len(s)):
	g += s[k]
print(g)


(N, T) = map(int, input().split())
S = list(input())
for t in range(T):
	i = 0
	while i + 1 < N:
		if S[i] == 'B' and S[i + 1] == 'G':
			(S[i], S[i + 1]) = (S[i + 1], S[i])
			i += 2
		else:
			i += 1
print(''.join(S))


(n, t) = map(int, input().split())
a = input()
a = list(a)
j = 0
while j < t:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i = i + 2
		else:
			i = i + 1
	j = j + 1
print(''.join(a))


(n, t) = map(int, input().split(' '))
s = list(input())
for j in range(t):
	l = s.copy()
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
	s = l
print(''.join((str(i) for i in s)))


(n, t) = map(int, input().split(' '))
l = list(input())
for _ in range(t):
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 2
		else:
			i += 1
print(''.join(l))


(n, t) = map(int, input().split())
l = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if l[j] < l[j + 1]:
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 2
		else:
			j += 1
print(''.join(l))


def changeQueue(queue, t):
	if t == 0:
		return queue
	else:
		willPass = False
		for i in range(len(queue)):
			if willPass == True:
				willPass = False
			elif i + 1 == len(queue):
				pass
			elif queue[i] == 'B' and queue[i + 1] == 'G':
				queue[i] = 'G'
				queue[i + 1] = 'B'
				willPass = True
		return changeQueue(queue, t - 1)
args = input().split()
n = int(args[0])
t = int(args[1])
queue = list(input())
print(''.join(changeQueue(queue, t)))


(n, t) = [int(x) for x in input().split()]
s = list(input())
for i in range(0, t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			temp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = temp
			j = j + 2
		else:
			j = j + 1
a = ''
for k in range(0, n):
	a = a + s[k]
print(a)


(num, raz) = input().split()
(num, raz) = (int(num), int(raz))
str2 = input().replace('B', '1').replace('G', '0')
array = [int(x) for x in str2]
for i in range(raz):
	bg = 0
	while bg < num - 1:
		if array[bg] > array[bg + 1]:
			(array[bg], array[bg + 1]) = (array[bg + 1], array[bg])
			bg += 2
		else:
			bg += 1
str1 = ''.join((str(e) for e in array))
print(str1.replace('1', 'B').replace('0', 'G'))


a = input().split(' ')
a = list(map(int, a))
c = input()
b = list(c)
d = ''
while a[1] > 0:
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 1
		i += 1
	a[1] -= 1
for i in range(len(b)):
	d += b[i]
print(d)


(n, t) = input().split()
n = int(n)
t = int(t)
ini = input()
for i in range(t):
	j = 0
	fin = ''
	while j < n:
		if j < n - 1 and ini[j] == 'B' and (ini[j + 1] == 'G'):
			fin += 'GB'
			j = j + 1
		else:
			fin += ini[j]
		j += 1
	ini = fin
print(ini)


line = input()
queue1 = input()
queue_length = int(line.split(' ')[0])
time = int(line.split(' ')[1])
queue_list = list(queue1)
for x in range(time):
	y = 0
	while y < queue_length - 1:
		if queue_list[y] == 'B' and queue_list[y + 1] == 'G':
			(queue_list[y + 1], queue_list[y]) = (queue_list[y], queue_list[y + 1])
			y += 2
		else:
			y += 1
print(''.join(queue_list))


(n, t) = list(map(int, input().split()))
s = list(input())
for i in range(t):
	a = 0
	while a < n - 1:
		if s[a] == 'B' and s[a + 1] == 'G':
			s[a] = 'G'
			s[a + 1] = 'B'
			a += 2
		else:
			a += 1
s = ''.join(s)
print(s)


a = input('').split()
for i in range(2):
	a[i] = int(a[i])
b = input('')
c = []
for d in b:
	c.append(d)
for i in range(a[1]):
	for j in range(len(c)):
		if (j == len(b) - 1) == False:
			if b[j] == 'B' and b[j + 1] == 'G':
				c[j] = 'G'
				c[j + 1] = 'B'
	b = ''
	for e in c:
		b += e
d = ''
for e in c:
	d += e
print(d)


x = input().split()
a = int(x[0])
b = int(x[1])
y = input()
yy = list(y)
i = 0
while i < b:
	j = 0
	while j < len(yy) - 1:
		if yy[j] < yy[j + 1]:
			tmp = yy[j]
			yy[j] = yy[j + 1]
			yy[j + 1] = tmp
			j += 1
		j += 1
	i += 1
z = ''.join(yy)
print(z)


def swap(string):
	s = string
	i = 0
	while i < len(s):
		if s[i:i + 2] == ['B', 'G']:
			(s[i], s[i + 1]) = ('G', 'B')
			i += 1
		i += 1
	return s
(n, t) = list(map(int, input().strip().split(' ')))
s = list(input().strip())
for j in range(t):
	s = swap(s)
print(''.join(s))


(a, b) = map(int, input().split())
s = list(input())
g = list(s)
t = 0
for i in range(b):
	s = list(g)
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			(g[j + 1], g[j]) = (g[j], g[j + 1])
			t = t + 1
for i in range(len(s)):
	print(g[i], end='')


(a, b) = map(int, input().split())
c = list(input())
k = c.copy()
for j in range(b):
	for i in range(a - 1):
		if c[i] == 'B' and c[i + 1] == 'G':
			(k[i], k[i + 1]) = (k[i + 1], k[i])
	c = k.copy()
print(''.join(k))


(a, b) = map(int, input().split())
s = input()
while b:
	s = s.replace('BG', 'GB')
	b -= 1
print(s)


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	cpy = list(s)
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			cpy[i] = 'G'
			cpy[i + 1] = 'B'
	s = ''.join(cpy)
print(s)


s = input().split()
y = list(input())
z = []
j = 0
p = int(s[0])
for i in range(int(s[1])):
	j = 0
	while j < len(y) - 1:
		if y[j] == 'B' and y[j + 1] == 'G':
			y[j + 1] = 'B'
			y[j] = 'G'
			j += 2
		else:
			j += 1
print(''.join(y))


A = input()
B = input()
C = []
z = ''
(m, n) = A.split()
for x in B:
	C.append(x)
for i in range(0, int(n)):
	D = []
	for j in range(0, int(m) - 1):
		if C[j] == 'B' and C[j + 1] == 'G':
			D.append(j)
	if len(D) > 0:
		for k in range(0, len(D)):
			z = C[D[k]]
			C[D[k]] = C[D[k] + 1]
			C[D[k] + 1] = z
E = ''
for s in C:
	E = E + s
print(E)


(n, t) = [int(s) for s in input().split()]
s = [i for i in input()]
for _ in range(t):
	i = 0
	while i < n:
		if i + 1 < n and s[i] == 'B' and (s[i + 1] == 'G'):
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	ind = []
	for j in range(1, n):
		if s[j - 1] == 'B' and s[j] == 'G' and (j - 1 not in ind):
			ind.append(j)
			temp = s[j]
			s[j] = s[j - 1]
			s[j - 1] = temp
print(''.join(s))


(n, t) = map(int, input().split())
queue = input()
goodqueue = []
i = 0
while i < n:
	goodqueue.append(queue[i])
	i = i + 1

def rearrangement(queue):
	i = 0
	while i < len(queue):
		if queue[i] == 'B' and i < len(queue) - 1 and (queue[i + 1] == 'G'):
			queue[i] = 'G'
			queue[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
j = 0
while j < t:
	rearrangement(goodqueue)
	j = j + 1
no_space = ''
print(no_space.join(goodqueue))


a = list(map(int, input().strip().split()))[:2]
b = ''
b = input()
b = list(b)
for i in range(a[1]):
	j = 0
	while j < a[0] - 1:
		if b[j] == 'B' and b[j + 1] == 'G':
			x = b[j]
			b[j] = b[j + 1]
			b[j + 1] = x
			j += 2
		else:
			j += 1
b = ''.join(b)
print(b)


nt = list(input().split(' '))
n = int(nt[0])
t = int(nt[1])
fila = list(input())
j = 1
while j <= t:
	for i in range(0, len(fila) - 1):
		if fila[i] == 'B' and fila[i + 1] == 'G':
			fila[i] = 'G'
			fila[i + 1] = 'BN'
	j += 1
	for k in range(len(fila)):
		if fila[k] == 'BN':
			fila[k] = 'B'
print(''.join(fila))


def checkPosition(queue, total):
	arrayIndex = []
	for i in range(0, total):
		if i + 1 < total:
			if queue[i] == 'B' and queue[i + 1] == 'G':
				arrayIndex.append(i)
	return arrayIndex
(total, time) = input().split()
total = int(total)
time = int(time)
line = input()
queue = []
for i in range(0, total):
	queue.append(line[i])
res = checkPosition(queue, total)
timeNow = 0
while timeNow < time:
	for i in range(0, len(res)):
		if queue[res[i]] == 'B' and queue[res[i] + 1] == 'G':
			(queue[res[i]], queue[res[i] + 1]) = (queue[res[i] + 1], queue[res[i]])
	res = checkPosition(queue, total)
	timeNow = timeNow + 1
print(''.join(queue))


(m, s) = map(int, input().split())
stu = list(input())
for i in range(s):
	j = 1
	while j < m:
		if stu[j] == 'G' and stu[j - 1] == 'B':
			(stu[j], stu[j - 1]) = (stu[j - 1], stu[j])
			j += 2
		else:
			j += 1
print(''.join(stu))


x = [int(i) for i in list(input().split(' '))]
y = list(input())
y.append('N')
for j in range(x[1]):
	i = 0
	while i < x[0]:
		if y[i] == 'B' and y[i + 1] == 'G':
			t = y[i]
			y[i] = y[i + 1]
			y[i + 1] = t
			i += 1
		i += 1
y.remove('N')
print(''.join(y))


(n, t) = map(int, input().split())
st = str(input())

def changeNeeded(st):
	return st.find('BG') != -1

def SwapBuddies(st):
	newSt = st.replace('BG', 'GB')
	return newSt
i = 0
while t > 0:
	if changeNeeded(st):
		st = SwapBuddies(st)
	t -= 1
print(st)


str = input().split()
n = int(str[0])
t = int(str[1])
order = input()
newOrder = ''
for i in range(t):
	counter = 0
	newOrder = ''
	while counter < len(order):
		if counter == len(order) - 1:
			newOrder += order[counter]
			counter += 1
		elif order[counter] == 'B' and order[counter + 1] == 'G':
			newOrder += 'GB'
			counter += 2
		elif order[counter] == 'B':
			newOrder += 'B'
			counter += 1
		else:
			newOrder += 'G'
			counter += 1
	order = newOrder
print(newOrder)


s1 = input()
n = int(s1.split()[0])
t = int(s1.split()[1])
mid = 0
s2 = input()
out = ''
line = [0 for i in range(0, n)]
for i in range(0, n):
	if s2[i] == 'B':
		line[i] = 1
	else:
		line[i] = 2
while t > 0:
	i = 0
	while i <= n - 2:
		if line[i] < line[i + 1]:
			mid = line[i]
			line[i] = line[i + 1]
			line[i + 1] = mid
			i += 2
		else:
			i += 1
	t -= 1
for i in range(0, n):
	if line[i] == 1:
		out += 'B'
	else:
		out += 'G'
print(out)


(a, b) = map(int, input().split())
queue = str(input())
none = True
number = 0
while none:
	number += 1
	if number == b + 1:
		none = False
	else:
		import re
		pattern = 'BG'
		queue = re.sub(pattern, 'GB', queue)
print(queue)


(n, t) = map(int, input().strip().split(' '))
s = input()
result = []
swappower = [t for _ in range(n)]
result.append(s[0])
for i in range(1, n):
	if result[-1] == 'G' or s[i] == 'B':
		result.append(s[i])
	else:
		k = i
		result.append(s[i])
		while k > 0 and swappower[k - 1] != 0 and (result[k - 1] != 'G') and (swappower[k] != 0):
			result[k] = 'B'
			result[k - 1] = 'G'
			swappower[k] = min(swappower[k - 1] - 1, t - (i - k) - 1)
			swappower[k - 1] = min(swappower[k - 1] - 1, t - (i - k) - 1)
			k -= 1
print(*result, sep='', end='')


(n, t) = list(map(int, input().split()))
a = input()
for i in range(t):
	a = a.replace('BG', 'GB')
print(a)


(n, t) = map(int, input().split())
queue = input()
lis_queue = list(queue)
count = 0
for i in range(t):
	for j in range(n):
		if lis_queue[j] == 'B':
			count += 1
		elif lis_queue[j] == 'G' and count > 0:
			lis_queue[j] = 'B'
			lis_queue[j - 1] = 'G'
			count = 0
	count = 0
print(''.join(lis_queue))


(n, k) = map(int, input().split())
lis = input()
lis = list(lis)
lis.reverse()
for i in range(k):
	j = 0
	while j < len(lis) - 1:
		if lis[j] == 'G' and lis[j + 1] == 'B':
			temp = lis[j]
			lis[j] = lis[j + 1]
			lis[j + 1] = temp
			j = j + 1
		j = j + 1
lis.reverse()
print(''.join(lis))


(n, t) = map(int, input().split())
s = input()
m = ''
for _ in range(t):
	m = ''
	i = 0
	while i != n:
		try:
			if s[i] == 'B' and s[i + 1] == 'G':
				m += 'GB'
				i += 2
			elif s[i] == 'G':
				m += 'G'
				i += 1
			else:
				m += 'B'
				i += 1
		except:
			m += s[n - 1]
			break
	s = m
print(s)


l = input().split()
n = int(l[0])
t = int(l[1])
l2 = list(input())
l3 = []
while t > 0:
	for i in range(len(l2) - 1):
		if l2[i] == 'B' and l2[i + 1] == 'G':
			l3.append(i)
		else:
			continue
	for _ in l3:
		l2[_] = 'G'
		l2[_ + 1] = 'B'
	l3 = []
	t = t - 1
print(''.join(l2))


def main():
	(n, t) = map(int, input().split())
	s = input()
	arr = [i for i in s]
	for i in range(t):
		tup = []
		for i in range(len(arr) - 1):
			if arr[i] == 'B' and arr[i + 1] == 'G':
				tup.append((i, i + 1))
		for i in tup:
			x = i[0]
			y = i[1]
			(arr[x], arr[y]) = (arr[y], arr[x])
	for i in arr:
		print(i, end='')
	print()
main()


(fu, sec) = map(int, input().split())
queue = input()
for i in range(sec):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, k) = map(int, input().split())
queue = input()
for i in range(k):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, t) = input().split()
n = int(n)
t = int(t)
ara = list(input())
for repeat in range(t):
	next_i = False
	for i in range(n):
		if next_i:
			next_i = False
			continue
		if i == n - 1:
			break
		if ara[i] == 'B':
			if ara[i + 1] == 'G':
				ara[i] = 'G'
				ara[i + 1] = 'B'
				next_i = True
print(''.join(ara))


def QueueAtTheSchool():
	(n, t) = map(int, input().split())
	s = input()
	Q = [i for i in s]
	for i in range(t):
		j = 0
		while j < len(Q) - 1:
			if Q[j] == 'B' and Q[j + 1] == 'G':
				(Q[j], Q[j + 1]) = (Q[j + 1], Q[j])
				j += 2
			else:
				j += 1
	s_f = ''.join(Q)
	print(s_f)
	return None

def main():
	QueueAtTheSchool()
main()


line = input()
(a, b) = (int(line.split(' ')[0]), int(line.split(' ')[1]))
row = input()
for i in range(0, b):
	row = row.replace('BG', 'GB')
print(row)


n = input()
n = int(n.split()[1])
s = input()
s = list(s)
mark = -1
i = 1
while i <= n:
	for j in range(len(s) - 1):
		if j == mark and s[j + 1] == 'G':
			mark = -1
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			mark = j + 1
	i = i + 1
s = ''.join(s)
print(s)


def shift(mod_string):
	l = list(mod_string)
	i = 0
	while i < len(mod_string) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 1
		i += 1
	return ''.join(l)

def process(n, shifter):
	string = input()
	while shifter > 0:
		string = shift(string)
		shifter -= 1
	print(string)

def main():
	p = [int(x) for x in input().split()]
	process(p[0], p[1])
main()


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	if 'BG' in s:
		n_s = s.replace('BG', 'GB')
		s = n_s
print(s)


(n, t) = map(int, input().split())
s = input()
A = []
index = []
for i in s:
	A.append(i)
while t > 0:
	for i in range(0, n - 1):
		if A[i] == 'B' and A[i + 1] == 'G':
			index.append(i)
	for i in index:
		(A[i], A[i + 1]) = (A[i + 1], A[i])
	index = []
	t -= 1
print(''.join(A))


(n, t) = map(int, input().split())
queue = list(input())
queue2 = queue.copy()
l = len(queue)
for _ in range(t):
	i = 0
	while i < l - 1:
		if queue[i + 1] == 'G' and queue[i] == 'B':
			(queue2[i], queue2[i + 1]) = (queue2[i + 1], queue2[i])
		i += 1
	queue = queue2.copy()
print(''.join(queue2))


inputLine = input()
inputList = inputLine.split(' ')
pop = int(inputList[0])
time = int(inputList[1])
inputLine = input()
popList = [inputLine[0]]
for k in range(1, pop):
	popList.append(inputLine[k])
for j in range(0, time):
	i = 0
	while i < pop - 1:
		if popList[i] == 'B' and popList[i + 1] == 'G':
			popList[i] = 'G'
			popList[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(popList))


m = input()
ips = []
ips.append(m.split())
t = int(ips[0][1])
ip = input()
for i in range(0, t):
	ip = ip.replace('BG', 'GB')
print(ip)


(hm, sec) = input().split(' ')
hm = int(hm)
sec = int(sec)
kids = list(input())
for k in range(sec):
	i = 0
	while i < hm:
		try:
			if kids[i] == 'B' and kids[i + 1] == 'G':
				kids[i] = 'G'
				kids[i + 1] = 'B'
				i += 1
		except IndexError:
			pass
		i += 1
print(''.join(kids))


(n, t) = [int(i) for i in input().split()]
s = input()
while t > 0:
	x = s.replace('BG', 'GB')
	s = x
	t -= 1
print(s)


(n, t) = [int(x) for x in input().split()]
s = input()
s = list(s)
m = 0
for _ in range(t):
	i = 0
	while i < n - 1:
		flag = 1
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			flag = 0
		if flag == 0:
			i = i + 2
		else:
			i = i + 1
print(''.join(s))


(a, b) = map(int, input().split())
c = list(input())
for x in range(b):
	i = 1
	while i < a:
		if c[i - 1] == 'B' and c[i] == 'G':
			c[i - 1] = 'G'
			c[i] = 'B'
			i = i + 2
		else:
			i = i + 1
c = ''.join(c)
print(c)


(n, t) = map(int, input().split())
s = [*input()]
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
print(*s, sep='')


p = input()
p = p.split()
n = int(p[0])
t = int(p[1])
q = input()
q = q.replace('', ' ')
q = q.split()
i = 1
while t > 0:
	i = 1
	while i < len(q):
		if q[i] == 'G' and q[i - 1] == 'B':
			q[i] = 'B'
			q[i - 1] = 'G'
			i += 1
		i += 1
	t -= 1
print(''.join(q))


(n, t) = input().split()
s = input()
(n, t) = (int(n), int(t))
u = list(s)
B = 'B'
G = 'G'
for _ in range(t):
	flag = 0
	for i in range(len(u) - 1):
		if u[0] == B and u[1] == G:
			(u[0], u[1]) = (u[1], u[0])
			flag = 1
		if flag == i:
			continue
		elif u[i] == B and u[i + 1] == G:
			(u[i], u[i + 1]) = (u[i + 1], u[i])
			flag = i + 1
z = ''.join(u)
print(z)


inp = list(map(int, input().split()))
s = input()
string = []
for i in range(len(s)):
	string.append(s[i])
t = inp[1]
c = 1
while c <= t:
	i = 0
	while i < len(string) - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			(string[i], string[i + 1]) = (string[i + 1], string[i])
			i += 2
		else:
			i += 1
	c += 1
final = ''
for i in string:
	final += i
print(final)


(n, t) = map(int, input().split())
a = list(input())
count = 0
for k in range(t):
	for i in range(n - 1):
		if count >= n - 1:
			break
		elif a[count] == 'B' and a[count + 1] == 'G':
			(a[count], a[count + 1]) = (a[count + 1], a[count])
			count = count + 2
		else:
			count = count + 1
	count = 0
	continue
print(''.join(a))


(n, t) = tuple(map(int, input().split()))
s = list(input())
for _ in ' ' * t:
	i = 0
	while i < n - 1:
		if s[i:i + 2] == ['B', 'G']:
			s[i:i + 2] = ['G', 'B']
			i += 1
		i += 1
print(''.join(s))


from sys import stdin, stdout

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_string():
	return stdin.readline().strip()

def main():
	write = stdout.write
	(n, t) = get_ints()
	s = list(get_string())
	for _ in range(t):
		i = 0
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				i += 1
			i += 1
	write(''.join(s))
	pass
main()


inputArray = input().split(' ')
t = int(inputArray[1])
qString = input()

def charposition(string, char):
	pos = []
	for n in range(len(string)):
		if string[n] == char:
			pos.append(n)
	return pos

def common_elements(a, b):
	a.sort()
	b.sort()
	(i, j) = (0, 0)
	common = []
	while i < len(a) and j < len(b):
		if a[i] == b[j]:
			common.append(a[i])
			i += 1
			j += 1
		elif a[i] < b[j]:
			i += 1
		else:
			j += 1
	return common
for y in range(t):
	b = charposition(qString, 'B')
	g = charposition(qString, 'G')
	mb = [x - 1 for x in g]
	co = common_elements(b, mb)
	for eleIndex in co:
		qArray = list(qString)
		qArray[eleIndex] = 'G'
		qArray[eleIndex + 1] = 'B'
		qString = ''.join(qArray)
print(qString)


def swap(queue, pos1, pos2):
	(queue[pos1], queue[pos2]) = (queue[pos2], queue[pos1])
	return queue

def queue_at_school(queue, time, actions=None):
	for x in range(time + 1):
		try:
			for action in actions:
				queue = swap(queue, action[0], action[1])
		except:
			pass
		actions = list()
		for student_pos in range(len(queue) - 1):
			if queue[student_pos] == 'B' and queue[student_pos + 1] == 'G':
				actions.append((student_pos, student_pos + 1))
	return ''.join((student for student in queue))
time = int(input().split(' ')[-1])
queue = [char for char in input()]
print(queue_at_school(queue, time))


p = list(map(int, input().split()))
s = list(input())
for i in range(p[1]):
	j = len(s) - 1
	while j > 0:
		if s[j - 1] == 'B' and s[j] == 'G':
			(s[j - 1], s[j]) = (s[j], s[j - 1])
			j -= 1
		j -= 1
print(''.join(map(str, s)))


import copy
(n, m) = [int(i) for i in input().split()]
str = list(input())
str1 = copy.deepcopy(str)
for w in range(0, m):
	for j in range(0, n - 1):
		if str[j] == 'B' and str[j + 1] == 'G':
			str1[j + 1] = 'B'
			str1[j] = 'G'
	str = copy.deepcopy(str1)
print(''.join(str1))


(a, n) = [int(i) for i in input().split()]
s = [i for i in input()]
for _ in range(n):
	flag = True
	for i in range(len(s) - 1):
		if flag:
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				flag = False
		else:
			flag = True
print(''.join(s))


(n, t) = [int(i) for i in input().split()]
data = input()
q = [c for c in data]
while t:
	t -= 1
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(q))


def run(q, n, t):
	new_q = []
	for dt in range(t):
		new_q = []
		new_q.extend(q)
		next_i = 0
		for i in range(n - 1):
			if next_i != i:
				continue
			if q[i] == 'G' or (q[i] == 'B' and q[i + 1] == 'B'):
				next_i = i + 1
				continue
			else:
				new_q[i] = q[i + 1]
				new_q[i + 1] = q[i]
				next_i = i + 2
		q = []
		q.extend(new_q)
	print(''.join(new_q))
ip = input()
row = [int(x) for x in ip.split(' ')]
n = row[0]
t = row[1]
q = input()
q_array = list(q)
run(q_array, n, t)


import re
(n, t) = list(map(int, input().split()))
s = input()
for i in range(t):
	s = re.sub('BG', 'GB', s)
print(s)


(n, t) = map(int, input().split())
S = list(input())
for i in range(t):
	N = S[:]
	for j in range(len(S) - 1, 0, -1):
		if S[j - 1] == 'B' and S[j] == 'G':
			(N[j - 1], N[j]) = (N[j], N[j - 1])
	S = N
print(''.join(S))


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
s = list(s)
k = 0
while k < t:
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 2
		else:
			j += 1
	k += 1
print(''.join(s))


(numberOfChildren, transformationTime) = [int(ip) for ip in input().split(' ')]
queueList = list(input())
for i in range(transformationTime):
	swappedOnce = False
	for (j, student) in enumerate(queueList):
		if swappedOnce == True:
			swappedOnce = False
			continue
		if j == 0:
			continue
		if queueList[j - 1] == 'B' and queueList[j] == 'G' and (swappedOnce == False):
			temp = queueList[j - 1]
			queueList[j - 1] = queueList[j]
			queueList[j] = temp
			swappedOnce = True
print(''.join(queueList))


(n, t) = [int(x) for x in input().split()]
s = input()
l = []
for i in s:
	if i == 'B':
		l.append(0)
	else:
		l.append(1)
for i in range(t):
	j = 0
	while j < n - 1:
		if l[j] == 0 and l[j + 1] == 1:
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 2
		else:
			j += 1
for i in l:
	if i == 0:
		print('B', end='')
	else:
		print('G', end='')


(num, t) = map(int, input().split(' '))
queue = list(input())
for time in range(t):
	i = 0
	while i < num - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 1
		i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	j = 0
	while j < n - 1:
		a = s[j]
		b = s[j + 1]
		if a == 'B' and b == 'G':
			s = s[:j] + 'G' + 'B' + s[j + 2:]
			j += 1
		j += 1
print(s)


(n, t) = map(int, input().split())
s = input()
s = list(s)
a = []
for i in range(t):
	for i in range(len(s)):
		a.append(0)
	for i in range(len(s)):
		if s[i] == 'B':
			a[i] = 1
		if s[i] == 'G':
			a[i] = 2
	for i in range(len(s) - 1):
		if a[i] < a[i + 1]:
			s[i] = 'G'
			s[i + 1] = 'B'
print(''.join(s))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
s = input()
line = []
for c in s:
	line.append(c)
	n -= 1
	if n is 0:
		break
while t > 0:
	t -= 1
	x = 0
	while x < len(line) - 1:
		if line[x] is 'B' and line[x + 1] is 'G':
			line[x] = 'G'
			line[x + 1] = 'B'
			x += 2
		else:
			x += 1
output = ''
for c in line:
	output += c
print(output)


X = input().split(' ')
Y = list(input())
for T in range(0, int(X[1])):
	V = 0
	for U in range(0, len(Y) - 1):
		if V == 1:
			V = 0
		elif Y[U] == 'B' and Y[U + 1] == 'G':
			Y[U] = 'G'
			Y[U + 1] = 'B'
			V = 1
print(''.join(Y))


(n, t) = list(map(int, input().split(' ')))
queue = list(input())
while t != 0:
	check = 0
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			check = 1
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
	if check == 0:
		break
	t -= 1
print(''.join(queue))


(numero, tempo) = map(int, input().split())
ordem = list(str(input()))
for j in range(tempo):
	i = 1
	while i < numero:
		if ordem[i] == 'G' and ordem[i - 1] == 'B':
			aux = ordem[i]
			ordem[i] = ordem[i - 1]
			ordem[i - 1] = aux
			i = i + 1
		i = i + 1
ordem = ''.join(ordem)
print(ordem)


def main():
	num_list = input().split()
	num = int(num_list[1])
	alpha_list = list(input())
	lenth = len(alpha_list)
	check = False
	out = ''
	for _ in range(num):
		for i in range(lenth):
			if check == False:
				if alpha_list[i] == 'G':
					pass
				elif alpha_list[i] == 'B' and i != lenth - 1 and (alpha_list[i + 1] == 'G'):
					alpha_list[i] = alpha_list[i + 1]
					alpha_list[i + 1] = 'B'
					check = True
			else:
				check = False
	for k in range(lenth):
		out += alpha_list[k]
	print(out)
main()


(n, t) = map(int, input().split())
queue = input()
str = 'GB'
for i in range(t):
	a = list(queue.split('BG'))
	queue = str.join(a)
print(queue)


(n, t) = map(int, input().split())
s = input()
res = s
for i in range(t):
	for j in range(1, n):
		if s[j - 1] == 'B' and s[j] == 'G':
			res = res[:j - 1] + 'GB' + res[j + 1:]
	s = res
print(res)


(n, t) = map(int, input().split())
line = list(input())
tmp = line.copy()
for j in range(t):
	for i in range(n - 1):
		if line[i] == 'B' and line[i + 1] == 'G':
			(tmp[i], tmp[i + 1]) = (tmp[i + 1], tmp[i])
	line = tmp.copy()
print(''.join(tmp))


z = input
(t, t) = z().split()
s = z()
for x in ' ' * int(t):
	s = s.replace('BG', 'GB')
print(s)


nt = input()
s = input()
nt = nt.split(' ')
n = int(nt[0])
t = int(nt[1])
for i in range(t):
	flag = 0
	for j in range(n - 1):
		if flag == 1:
			flag = 0
		elif s[j] == 'B' and s[j + 1] == 'G':
			s = s[:j] + 'GB' + s[j + 2:]
			flag = 1
		else:
			flag = 0
print(s)


(n, t) = map(int, input().split())
z = input()
s = []
for i in range(n):
	s.append(z[i])
j = 0
for i in range(t):
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
	j = 0
print(''.join(s))


a = input().split()
t = int(a[1])
k = input()
for i in range(t):
	k = k.replace('BG', 'GB')
print(k)


a = [int(i) for i in input().split()]
b = [i for i in input()]
temp = ''
for j in range(a[1]):
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B':
			if b[i + 1] == 'G':
				temp = b[i]
				b[i] = b[i + 1]
				b[i + 1] = temp
				i += 1
		i += 1
[print(i, end='') for i in b]


(m, n) = list(map(int, input().split()))
s = input()
while n:
	i = 0
	o = ''
	while i < m:
		if i >= m - 1:
			o += s[i]
			break
		if s[i] < s[i + 1]:
			o += s[i + 1]
			o += s[i]
			i += 2
		else:
			o += s[i]
			i += 1
	s = o
	n -= 1
print(o)


(m, n) = map(int, input().split())
a = list(str(input()))
for i in range(n):
	j = 0
	while j < len(a) - 1:
		s = a[j]
		if s == 'B' and a[j + 1] == 'G':
			(a[j], a[j + 1]) = ('G', 'B')
			j = j + 2
		else:
			j = j + 1
print(''.join(a))


string = input()
s = string.split(' ')
n = int(s[0])
t = int(s[1])
lst = [0] * n
string = input()
for i in range(n):
	if string[i] == 'G':
		lst[i] = 1
for j in range(t):
	bl = 0
	for i in range(n):
		if lst[i] == bl:
			bl = bl + 1
		if bl == 2:
			(lst[i - 1], lst[i]) = (lst[i], lst[i - 1])
			bl = 0
ans = ''
for i in range(n):
	if lst[i] == 0:
		ans += 'B'
	else:
		ans += 'G'
print(ans)


(n, t) = list(map(int, input().split()))
d = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if d[j] == 'B' and d[j + 1] == 'G':
			d[j] = 'G'
			d[j + 1] = 'B'
			j += 1
		j += 1
for j in range(n):
	print(d[j], end='')


(n, t) = map(int, input().split())
s = input()
arr = list(map(str, s))
pos = list()
count = 0
i = 0
for j in range(t):
	while i < n - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			arr.pop(i)
			arr.insert(i, 'G')
			arr.pop(i + 1)
			arr.insert(i + 1, 'B')
			i = i + 2
			continue
		i = i + 1
	i = 0
print(''.join(arr))


from sys import stdin

def sin():
	return stdin.readline()
(n, t) = map(int, sin().split())
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = list(map(int, input().split(' ')))
l = list(input())
for every_second in range(t):
	b = {}
	for i in range(len(l) - 1):
		b[i] = False
		if l[i] == 'B' and l[i + 1] == 'G':
			b[i] = True
	for i in range(len(l) - 1):
		if b[i] == True:
			e = l[i]
			l[i] = l[i + 1]
			l[i + 1] = e
print(''.join(l))


a = list(map(int, input().split(' ')))
b = list(input())
x = 0
while a[1] > 0:
	while x < len(b) - 1:
		if b[x] == 'B' and b[x + 1] == 'G':
			(b[x + 1], b[x]) = (b[x], b[x + 1])
			x += 1
		x += 1
	x = 0
	a[1] = a[1] - 1
[print(x, end='') for x in b]


(n, k) = map(int, input().split(' '))
s = list(input())
for i in range(k):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j + 1] = 'B'
			s[j] = 'G'
			j += 2
		else:
			j += 1
	i = i + 1
print(''.join(s))


def swap(p):
	i = 0
	while True:
		if i + 1 < len(p):
			if p[i] == 'B' and p[i + 1] == 'G':
				(p[i], p[i + 1]) = ('G', 'B')
				i += 1
		i += 1
		if i >= len(p):
			break
	return p
(n, t) = map(int, input().split(' '))
s = list(input())
for i in range(t):
	s = swap(s)
print(''.join(s))


inp = input().split(' ')
n = inp[0]
t = int(inp[1])
q = list(input())
for i in range(0, t):
	temp = q.copy()
	for k in range(0, int(n) - 1):
		if q[k] == 'B' and q[k + 1] == 'G':
			temp[k] = 'G'
			temp[k + 1] = 'B'
	q = temp
print(''.join(temp))


ini = input().split()
n = int(ini[0])
t = int(ini[1])
s = input()
a = []
for x in range(n):
	a.append(s[x])
while t != 0:
	w = []
	for x in range(n):
		if a[x] == 'B':
			w.append(x)
	for c in w:
		x = c
		if a[x] == 'B':
			if x + 1 < n and a[x + 1] == 'G':
				a[x] = 'G'
				a[x + 1] = 'B'
			else:
				pass
	t = t - 1
for x in a:
	print(x, end='')


(n, m) = [int(i) for i in input().split()]
a = input()
a = list(a)
b = [0 for i in range(n)]
j = 0
for i in range(m):
	j = 0
	while j < n - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			j = j + 1
		j = j + 1
print(''.join(a))


import sys
import math
(n, t) = input().split()
queue = input()

def swap(string, a, b):
	string = list(string)
	(string[a], string[b]) = (string[b], string[a])
	return ''.join(string)
for j in range(int(t)):
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue = swap(queue, i, i + 1)
			i += 1
		i += 1
print(queue)


(n, t) = map(int, input().split())
x = [x for x in input()]
for i in range(t):
	j = 0
	while j < n - 1:
		if x[j] == 'B' and x[j + 1] == 'G':
			(x[j], x[j + 1]) = (x[j + 1], x[j])
			j += 2
		else:
			j += 1
for u in x:
	print(u, end='')


s = str(input())
s = s.split(' ')
n = int(s[0])
t = int(s[1])
s = str(input())
s = [str(ss) for ss in s]
for tt in range(0, t):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
for ss in s:
	print(ss, sep='', end='')
print()


(n, m) = map(int, input().split())
q = list(input())
t = 1
while t <= m:
	I = tuple(q)
	for i in range(n - 1):
		if I[i] == 'B' and I[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
	t += 1
s = ''
for i in range(n):
	s += q[i]
print(s)


from sys import stdin
(a, y) = [int(z) for z in stdin.readline().split()]
x = list(stdin.readline().strip())
for j in range(y):
	i = 0
	while i <= len(x) - 1:
		if i < len(x) - 1 and x[i + 1] == 'G' and (x[i] == 'B'):
			(x[i + 1], x[i]) = ('B', 'G')
			i += 1
		i += 1
print(''.join(x))


(n, t) = [int(x) for x in input().split()]
line = list(input())
for i in range(t):
	tmp = list(line)
	for i2 in range(1, n):
		if line[i2] == 'G' and line[i2 - 1] == 'B':
			tmp[i2] = 'B'
			tmp[i2 - 1] = 'G'
	line = list(tmp)
print(''.join(line))


nt = input().split()
n = int(nt[0])
t = int(nt[1])
s = input()
i = 0
for j in range(0, t):
	while i < n:
		if i == n - 1:
			i = i + 1
		elif s[i] == 'B' and s[i + 1] == 'G':
			s = s[0:i] + 'G' + 'B' + s[i + 2:n]
			i = i + 2
		elif s[i] == 'B' and s[i + 1] == 'B':
			i = i + 1
		elif s[i] == 'G':
			i = i + 1
	i = 0
print(s)


(people, seconds) = map(int, input().split())
(prev, cur) = (input(), '')
while seconds > 0:
	idx = 0
	while idx < people:
		if idx == people - 1:
			cur += prev[idx]
			break
		if prev[idx] == 'B' and prev[idx + 1] == 'G':
			cur += 'G'
			cur += 'B'
			idx += 1
		else:
			cur += prev[idx]
		idx += 1
	prev = cur
	cur = ''
	seconds -= 1
print(prev)


import re

def moveBoys(s, t):
	fs = list(s)
	for _ in range(t):
		idx = [m.start() for m in re.finditer('BG', s)]
		for x in idx:
			temp = fs[x]
			fs[x] = fs[x + 1]
			fs[x + 1] = temp
			s = ''.join(fs)
	return s
inp = input()
(n, t) = map(int, inp.split())
s = input()
print(moveBoys(s, t))


a = list(map(int, input().split()))
x = a[0]
n = a[1]
b = input()
for i in range(n):
	j = 0
	while j < x - 1:
		if b[j] == 'B' and b[j + 1] == 'G':
			b = b[:j] + 'GB' + b[j + 2:]
			j += 1
		j += 1
print(b)


(n, t) = list(map(int, input().split()))
s = list(input())
for i in range(t):
	flag = 0
	for j in range(len(s) - 1):
		if flag == 1:
			flag = 0
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			flag = 1
print(''.join(s))


(n, t) = input().split()
n = int(n)
t = int(t)
position = list(input())

def buffalo(x):
	position[x] = 'G'
	position[x + 1] = 'B'
detect = []
while t > 0:
	for i in range(n - 1):
		if position[i] == 'B' and position[i + 1] == 'G':
			detect.append(i)
		else:
			pass
	for y in detect:
		buffalo(y)
	t -= 1
ans = ''.join(position)
print(ans)


(n, t) = [int(x) for x in input().split()]
que = input()

def queue(x):
	if 'BG' in x:
		return 1
for i in range(t):
	if queue(que) == 1:
		que = que.replace('BG', 'GB')
	else:
		que = que
print(que)


a = int(input()[2:])
c = input()
while a:
	c = c.replace('BG', 'GB')
	a -= 1
print(c)


(n, m) = map(int, input().split())
string = input()
for i in range(m):
	if 'BG' in string:
		string = string.replace('BG', 'GB')
print(string)


(n, t) = [int(data) for data in input().split()]
queue = list(input())
for sec in range(t):
	pos = 0
	while pos < len(queue) - 1:
		if queue[pos] == 'B' and queue[pos + 1] == 'G':
			queue[pos] = 'G'
			queue[pos + 1] = 'B'
			pos = pos + 1
		pos = pos + 1
print(''.join(queue))


(_, t) = map(int, input().split())
s = input()
for _ in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = [int(i) for i in input().split()]
a = [i for i in input().strip()]
for i in range(t):
	falg = 1
	for j in range(n - 1):
		falg -= 1
		if a[j] == 'B' and a[j + 1] == 'G' and (falg <= 0):
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			falg = 2
print(''.join(a))


import sys
(n, t) = map(int, sys.stdin.readline().split())
s = input()
m = ''
i = 0
while t > 0:
	while i <= n - 1:
		if i == n - 1:
			m = m + s[i]
			i = i + 1
		elif s[i] == 'B' and s[i + 1] == 'G':
			m = m + s[i + 1]
			m = m + s[i]
			i = i + 2
		else:
			m = m + s[i]
			i = i + 1
	i = 0
	s = m
	m = ''
	t = t - 1
print(s)


def main():
	(n, t) = input().split()
	line = list(input())
	for _ in range(int(t)):
		temp_line = []
		index = 0
		while True:
			if index == int(n) - 1:
				temp_line.append(line[index])
				break
			if index == int(n):
				break
			if line[index] == 'B' and line[index + 1] == 'G':
				temp_line.append('G')
				temp_line.append('B')
				index += 2
			else:
				temp_line.append(line[index])
				index += 1
		line = temp_line
	print(''.join(line))
main()


(n, t) = map(int, input().split())
x = list(input())
for i in range(t):
	j = 1
	while j < n:
		if x[j] == 'G' and x[j - 1] == 'B':
			(x[j - 1], x[j]) = (x[j], x[j - 1])
			j += 1
		j += 1
print(*x, sep='')


(n, t) = map(int, input().split())
s = list(input())
for _ in range(t):
	ns = s.copy()
	for i in range(1, n):
		if s[i - 1] < s[i]:
			(ns[i], ns[i - 1]) = (ns[i - 1], ns[i])
	s = ns
print(''.join(s))


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	(n, t) = map(int, input().split(' '))
	a = list(input())
	for x in range(t):
		y = 0
		while y < n - 1:
			if a[y] == 'B' and a[y + 1] == 'G':
				(a[y], a[y + 1]) = (a[y + 1], a[y])
				y += 2
			else:
				y += 1
	print(''.join(a))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def reform(x):
	l = len(x)
	q1 = list(x)
	for i in range(l - 1):
		if x[i] == 'B' and x[i + 1] == 'G':
			q1[i] = 'G'
			q1[i + 1] = 'B'
	return ''.join(q1)
(n, t) = map(int, input().split())
q = input()
for i in range(t):
	q = reform(q)
print(q)


(n, t) = map(int, input().split())
s = input()
arr = list(s)
for i in range(t):
	swapped = [False] * n
	for j in range(1, n):
		if arr[j - 1] == 'B' and arr[j] == 'G' and (swapped[j] == False) and (swapped[j - 1] == False):
			(arr[j - 1], arr[j]) = (arr[j], arr[j - 1])
			swapped[j] = True
			swapped[j - 1] = True
print(''.join(arr))


(n, t) = input().split()
s = [_ for _ in input()]
st = s[:]
for i in range(int(t)):
	for j in range(len(s) - 1):
		if st[j] == 'B' and st[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
	st = s[:]
print(''.join(s))


(n, t) = input().strip().split()
(n, t) = (int(n), int(t))
s = input()
s = s.upper()
lst = list(s)
for a0 in range(t):
	i = 0
	while i <= n - 2:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			(lst[i], lst[i + 1]) = (lst[i + 1], lst[i])
			i += 2
		else:
			i += 1
string = ''.join(lst)
print(string)


def swap(st, li):
	k = list(st)
	for i in li:
		(k[i], k[i + 1]) = (k[i + 1], k[i])
	return ''.join(k)
(n, t) = map(int, input().split())
s = input()
for i in range(t):
	l = [j for j in range(len(s)) if s.startswith('BG', j)]
	s = swap(s, l)
print(s)


(number_of_children, time_to_reshape_que) = [int(i) for i in input().split()]
initial_arrangement = input()
for i in range(time_to_reshape_que):
	initial_arrangement = initial_arrangement.replace('BG', 'GB')
print(initial_arrangement)


(n, t) = map(int, input().split())
s = input()
new_string = s
for _ in range(t):
	pos = 0
	s = new_string
	while pos < n - 1:
		if s[pos] == 'B' and s[pos + 1] == 'G':
			new_string = new_string[:pos] + new_string[pos + 1] + new_string[pos] + new_string[pos + 2:]
			pos += 2
		else:
			pos += 1
print(new_string)


a = input().split(' ')
p = int(a[0])
t = int(a[1])
l = input()
d = []
i = 0
c = []
while t != 0:
	while i < p:
		try:
			if l[i] == 'B' and l[i + 1] == 'G':
				d.append('G')
				d.append('B')
				i += 2
			else:
				d.append(l[i])
				i += 1
		except IndexError:
			d.append(l[i])
			break
	t -= 1
	i = 0
	l = ''.join(d)
	c.append(d)
	d.clear()
print(l)


(n, t) = [int(i) for i in input().split()]
s = input()
a = []
for i in range(n):
	a.append(s[i])
while t > 0:
	fq = n * [0]
	for i in range(n - 1):
		if a[i] == 'B':
			if a[i + 1] == 'G':
				fq[i] += 1
	for i in range(n):
		if fq[i] == 1:
			a[i] = 'G'
			a[i + 1] = 'B'
	t -= 1
	if t == 0:
		for i in range(n):
			print(a[i], end='')


(x, y) = [int(x) for x in input().split()]
a = input()
for i in range(1, y + 1):
	if 'BG' in a:
		a = a.replace('BG', 'GB')
print(a)


(n, t) = map(int, input().split())
queue = list(input())
c_q = queue.copy()

def polite():
	for i in range(n - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(c_q[i], c_q[i + 1]) = ('G', 'B')
for i in range(t):
	polite()
	queue = c_q.copy()
print(*c_q, sep='')


from typing import List
LOCAL = False
if LOCAL:
	import os
	import sys
	import time
	start = time.time()
	letter = 'A'
	sys.stdin = open(f'{letter}in.txt', 'r')
	sys.stdout = open(f'{letter}out.txt', 'w')
G = 'G'
B = 'B'

def calculate(queue: List[str], t):
	for j in range(t):
		swaps = False
		i = len(queue) - 2
		while i >= 0:
			if queue[i + 1] == G and queue[i] == B:
				(queue[i + 1], queue[i]) = (queue[i], queue[i + 1])
				swaps = True
				i -= 1
			i -= 1
		if not swaps:
			break
	return ''.join(queue)
(n, t) = map(int, input().split())
queue = list(input())
print(calculate(queue, t))
if LOCAL:
	print('TIME:', time.time() - start, 'sec.')


(n, m) = map(int, input().split())
s = list(input())
while m:
	ss = s[:]
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			(ss[i], ss[i + 1]) = ('G', 'B')
	s = ss
	m -= 1
print(*s, sep='')


(n, p) = map(int, input().split())
s = input()
s = list(s)
while p:
	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 += 1
		i += 1
	p -= 1
print(''.join(s))


nt = input().split(' ')
n = int(nt[0])
t = int(nt[1])
bg = list(input())
for i in range(t):
	flag = True
	for j in range(n - 1):
		if flag and bg[j] == 'B' and (bg[j + 1] == 'G'):
			(bg[j], bg[j + 1]) = (bg[j + 1], bg[j])
			flag = False
		else:
			flag = True
print(''.join(bg))


s = input().split()
x = input()
a = []
t = 0
for i in range(len(x)):
	a.append(x[i])
while t < int(s[1]):
	b = a[:]
	for j in range(int(s[0])):
		if j == int(s[0]) - 1:
			break
		if a[j] == 'B' and a[j + 1] == 'G':
			b[j] = 'G'
			b[j + 1] = 'B'
	t = t + 1
	a = b
y = ''.join(a)
print(y)


num = list(map(int, input().rstrip().split()))
string = list(input())
i = 1
while num[1]:
	while i < num[0]:
		if string[i - 1] == 'B' and string[i] == 'G':
			string[i - 1] = 'G'
			string[i] = 'B'
			i += 1
		i += 1
	num[1] -= 1
	i = 1
print(''.join(string))


(n, x) = map(int, input().split())
s = str(input())
word = list(s)
for j in range(x):
	i = 1
	while n > i:
		if word[i - 1] == 'B' and word[i] == 'G':
			(word[i - 1], word[i]) = (word[i], word[i - 1])
			i += 2
		else:
			i += 1
string = ''.join(word)
print(string)


nm = list(map(int, input().split()))
q = input()
q = [j for j in q]
for _ in range(nm[1]):
	i = 0
	while i < nm[0] - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			i += 1
		i += 1
print(''.join(q))


inp = list(map(int, input().split()))
(n, s) = (inp[0], inp[1])
que = list(input())
que1 = que.copy()
for i in range(s):
	for j in range(0, n - 1):
		if que[j] == 'B' and que[j + 1] == 'G':
			(que1[j], que1[j + 1]) = (str('G'), str('B'))
	que = que1.copy()
print(''.join(map(str, que1)))


(n, t) = map(int, input().split())
s = list(input())
for _ in range(t):
	pre = 'G'
	for i in range(n):
		if pre == 'B':
			pre = s[i]
			(s[i], s[i - 1]) = (s[i - 1], s[i])
		else:
			pre = s[i]
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	nextContinue = False
	for j in range(n - 1):
		if nextContinue:
			nextContinue = False
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			nextContinue = True
print(''.join(s))


(n, time) = list(map(int, input().split()))
queue = list(str(input()))
while time != 0:
	i = 0
	while i < n:
		if queue[i] == 'B':
			j = i + 1
			while j < n and queue[j] != 'B':
				if queue[j] == 'G':
					(queue[j], queue[i]) = (queue[i], queue[j])
					i += 1
					break
				j += 1
		i += 1
	time -= 1
for i in range(len(queue)):
	print(queue[i], end='')
print()


(n, t) = map(int, input().split())
initial_str = input()
final_str = ''
for i in range(t):
	final_str = ''
	j = 0
	while j < n:
		if j != n - 1 and initial_str[j] == 'B' and (initial_str[j + 1] == 'G'):
			final_str += 'GB'
			j = j + 1
		else:
			final_str += initial_str[j]
		j = j + 1
	initial_str = final_str
print(final_str)


try:
	(n, t) = list(map(int, input().split()))
	s = list(input())
	while t:
		i = 0
		while i < len(s) - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				i += 2
			else:
				i += 1
		t -= 1
	print(''.join(s))
except:
	pass


(n, t) = map(int, input().split())
c = []
a = input().replace(' ', '')
for i in range(t):
	for j in range(len(a)):
		if j != n - 1:
			if a[j] == 'B' and a[j + 1] == 'G':
				c.append(j)
	for j in c:
		a = a[:j] + 'G' + 'B' + a[j + 2:]
print(a)


inputs = input().split(' ')
for i in range(len(inputs)):
	inputs[i] = int(inputs[i])
queue = input()
for i in range(inputs[1]):
	step = 0
	while step < inputs[0] - 1:
		if queue[step] == 'B' and queue[step + 1] == 'G':
			queue = queue[:step] + 'GB' + queue[step + 2:]
			step += 1
		step += 1
print(queue)


(n, t) = map(int, input().split())
a = list(input())
for i in range(t):
	a1 = []
	k = 0
	while k < n:
		if k == n - 1 and len(a1) != k + 2:
			a1.append(a[k])
		elif a[k] == 'B' and a[k + 1] == 'G':
			a1.append('G')
			a1.append('B')
			k += 1
		elif len(a1) != k + 2:
			a1.append(a[k])
		k += 1
	a = a1
print(''.join(a))


(n, t) = list(map(int, input().split()))
A = list(input())
for i in range(t):
	j = n - 1
	stop = 0
	while j > stop:
		if A[j] == 'G' and A[j - 1] == 'B':
			(A[j], A[j - 1]) = ('B', 'G')
			j -= 1
		j -= 1
sstr = ''
print(sstr.join(A))


from sys import stdin, stdout
(t, s) = (int(stdin.readline().split()[1]), stdin.readline())
for _ in range(t):
	s = s.replace('BG', 'GB')
stdout.write(s)


(n, t) = input().split()
n = int(n)
t = int(t)
row = input()
for i in range(t):
	try:
		row = row.replace('BG', 'GB')
	except:
		pass
print(row)


line = list(map(int, input().split(' ')))
n = line[0]
t = line[1]
line = input()
tempLine = line
if n < 2:
	print(line)
else:
	for i in range(0, t):
		if line[len(line) - 2] + line[len(line) - 1] == 'BG':
			tempLine = tempLine[0:n - 2] + 'GB'
		if line[0] + line[1] == 'BG':
			tempLine = 'GB' + tempLine[2:]
		for j in range(1, n - 2):
			if line[j] + line[j + 1] == 'BG':
				tempLine = tempLine[0:j] + 'GB' + tempLine[j + 2:]
		line = tempLine
	print(line)


(length, second) = map(int, input().split())
s = input()
while second:
	s = s.replace('BG', 'GB')
	second -= 1
print(s)


(number, time) = map(int, input().split())
string = input()
for i in range(time):
	string = string.replace('BG', 'GB')
print(string)


t = int(input().split()[1])
q1 = list(input())
q2 = q1[:]
for i in range(t):
	for j in range(len(q1) - 1):
		if q1[j] == 'B' and q1[j + 1] == 'G':
			q2[j] = 'G'
			q2[j + 1] = 'B'
	q1 = q2[:]
print(''.join(q2))


def swap(lis, a, b):
	if b > len(lis) - 1:
		return lis
	c = lis[b]
	lis[b] = lis[a]
	lis[a] = c
	return lis

def degrade(text):
	lis = list(text)
	index = list()
	for i in range(len(lis)):
		if lis[i] == 'B':
			index.append(i)
	for i in range(len(index)):
		swap(lis, index[i], index[i] + 1)
	return ''.join(lis)
(n, t) = map(int, input().split())
text = input()
for i in range(t):
	text = degrade(text)
print(text)


(line_len, ticks) = input().split(' ')
line_len = int(line_len)
ticks = int(ticks)
order = list(input())
for _ in range(ticks):
	new_str = ''
	skip_one = False
	for index in range(0, len(order)):
		if skip_one:
			skip_one = False
			continue
		if index < len(order) - 1 and order[index] == 'B' and (order[index + 1] == 'G'):
			new_str += 'GB'
			skip_one = True
		else:
			new_str += order[index]
	order = list(new_str)
print(new_str)


(num, time) = input().split()
line = input()
for i in range(int(time)):
	line = line.replace('BG', 'GB')
print(line)


inp1 = input()
order = list(input())
(num, t) = inp1.split(' ')
i = 0
for i in range(int(t)):
	j = 0
	while j < int(num) - 1:
		if order[j] == 'B' and order[j + 1] == 'G':
			(order[j], order[j + 1]) = (order[j + 1], order[j])
			j = j + 1
		j = j + 1
order = ''.join(order)
print(order)


initIn = str(input())
initList = initIn.split()
qSize = int(initList[0])
time = int(initList[1])
queue = str(input())
for i in range(0, time):
	queue = queue.replace('BG', 'GB')
print(queue)


from sys import stdin, stdout

def norm(sa):
	boo = [False] * len(sa)
	for i in range(0, len(sa) - 1):
		if sa[i] == 'B' and sa[i + 1] == 'G' and (boo[i] == False) and (boo[i + 1] == False):
			sa[i] = 'G'
			sa[i + 1] = 'B'
			boo[i] = True
			boo[i + 1] = True
(n, t) = map(int, stdin.readline().split())
s = input()
sa = list(s)
for i in range(0, t):
	norm(sa)
for i in range(0, len(sa)):
	print(sa[i], end='')


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
Line = []
i = 0
while i < n:
	Line.append(s[i])
	i = i + 1
j = 0
i = 0
while i < t:
	j = n - 1
	while j > 0:
		if Line[j - 1] == 'B' and Line[j] == 'G':
			Line[j - 1] = 'G'
			Line[j] = 'B'
			j = j - 2
		else:
			j = j - 1
	i = i + 1
print(''.join(Line))


(n, t) = map(int, input().split(' '))
s = [w for w in input()]
for _ in range(t):
	i = 0
	while i < n - 1:
		if s[i] < s[i + 1]:
			temp = s[i]
			s[i] = s[i + 1]
			s[i + 1] = temp
			i = i + 2
		else:
			i = i + 1
print(''.join(s))


(m, n) = map(int, input().split())
l = list(str(input()))
s = []
for i in l:
	s.append(i)
for j in range(n):
	for i in range(m - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
	for k in range(len(l)):
		l[k] = s[k]
z = str()
for x in s:
	z = z + x
print(z)


def main():
	info = input().split()
	students = int(info[0])
	sec = int(info[1])
	done = 0
	queue = input()
	while done < sec:
		newq = []
		i = 0
		while i < students:
			if queue[i] == 'B':
				if i + 1 < students:
					if queue[i + 1] == 'G':
						newq.append(queue[i + 1])
						newq.append(queue[i])
						i += 2
					else:
						newq.append(queue[i])
						i += 1
				else:
					newq.append(queue[i])
					i += 1
			else:
				newq.append(queue[i])
				i += 1
		done += 1
		queue = newq
	print(''.join(queue))
main()


(n, t) = list(map(int, input().split()))
s = input()
for _ in range(t):
	check = False
	for i in range(len(s) - 1):
		if check:
			check = False
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			s = s[:i] + 'GB' + s[i + 2:]
			check = True
print(s)


def swap(x, a, b):
	temp = x[a]
	x[a] = x[b]
	x[b] = temp
(n, t) = map(int, input().split())
x = input()
x = list(x)
boys = []
for i in range(0, n, 1):
	if x[i] == 'B':
		boys.append(i)
for z in range(0, t, 1):
	for i in range(0, len(boys), 1):
		if boys[i] != n - 1 and x[boys[i] + 1] == 'G':
			swap(x, boys[i], boys[i] + 1)
			boys[i] += 1
for i in x:
	print(i, end='')
print()


(n, t) = map(int, input().split())
s = list(input())
for j in range(t):
	i = 0
	while i <= len(s) - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i + 1], s[i]) = ('B', 'G')
			i += 2
		else:
			i += 1
for c in s:
	print(c, end='')


s = str(input(''))
l = s.split(' ')
n = int(l[0])
t = int(l[1])
s = str(input())
l = []
for i in range(len(s)):
	l.append(s[i])
for i in range(t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 2
		else:
			j += 1
print(''.join(l))


(n, t) = [int(i) for i in input().split()]
q = input()
for j in range(t):
	closed = False
	for i in range(n - 1):
		if closed:
			closed = False
			continue
		if q[i] == 'B' and q[i + 1] == 'G':
			q = q[:i] + 'GB' + q[i + 2:]
			closed = True
print(q)


def f(w):
	i = 0
	while i < len(w) - 2:
		if w[i] == 'B' and w[i + 1] == 'G':
			w = w[:i] + 'GB' + w[i + 2:]
			i = i + 2
		else:
			i = i + 1
	if w[-2] == 'B' and w[-1] == 'G':
		w = w[:-2] + 'GB'
	return w
(n, t) = map(int, input().split())
a = str(input())
x = n - a.count('B') - 1
for i in range(t):
	if a.find('B') > x or a.find('B') == -1:
		break
	else:
		a = f(a)
print(a)


m = list(map(int, input().split()))
t = m[1]
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
li = str(input())
l = list(li)
for n in range(t):
	i = 1
	while i < len(l):
		if l[i] == 'G' and l[i - 1] == 'B':
			l[i - 1] = 'G'
			l[i] = 'B'
			i = i + 1
		i = i + 1
print(''.join(l))


value = input()
(n, t) = value.split()
n = int(n)
t = int(t)
flag = 0
values = input()
values = [i for i in values]
while t:
	for i in range(len(values) - 1):
		if flag == 1:
			flag = 0
			continue
		if values[i] == 'B' and values[i + 1] == 'G':
			temp = values[i]
			values[i] = values[i + 1]
			values[i + 1] = temp
			flag = 1
	flag = 0
	t -= 1
for i in values:
	print(i, end='')


from sys import stdin

def iinput():
	return int(stdin.readline())

def sinput():
	return input()

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
(n, t) = minput()
s = list(sinput())
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = ('G', 'B')
			j += 1
		j += 1
print(''.join(s))


(n, t) = map(int, input().split())
str = input()
queue = list(str)
for _ in range(t):
	j = 0
	while j < len(queue) - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			queue[j] = 'G'
			queue[j + 1] = 'B'
			j += 2
			continue
		j += 1
print(''.join(queue))


(n, t) = map(int, input().split())
p = str(input())
while t > 0:
	pt = p.replace('BG', 'GB')
	p = pt
	t -= 1
print(p)


import sys

def main():
	(_, t) = map(int, input().split())
	children = input()
	for i in range(t):
		children = children.replace('BG', 'GB')
	print(children)
main()


(n, t) = tuple(map(int, input().strip().split()))
q = list(input().strip())
while t > 0:
	i = 1
	while i < n:
		if q[i - 1] == 'B' and q[i] == 'G':
			(q[i - 1], q[i]) = ('G', 'B')
			i += 1
		i += 1
	t -= 1
print(''.join(q))


(number, time) = [int(i) for i in input().split()]
queue = list(input())
queue.append('E')
while time:
	time -= 1
	i = 0
	while i < number - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue[i + 1] = 'B'
			queue[i] = 'G'
			i += 2
		else:
			i += 1
queue.pop()
print(''.join(queue))


def Sol(stri):
	qer = ''
	i = 0
	while i < len(stri) - 1:
		if stri[i] == 'B' and stri[i + 1] == 'G':
			qer += 'GB'
			i += 2
		else:
			qer += stri[i]
			i += 1
	qer += ['', 'B'][stri[-1] == 'B']
	qer += ['', 'G'][stri[-1] == 'G' and len(qer) != len(stri)]
	return qer

def Ts(st, n):
	for i in range(n):
		st = Sol(st)
	return st
i = lambda : map(int, input().split())
(nn, n) = i()
ss = input()
print(Ts(ss, n))


(n, m) = list(map(int, input().split()))
text = list(input())
while m > 0:
	i = 0
	while i < n - 1:
		if text[i] == 'B' and text[i + 1] == 'G':
			text[i] = 'G'
			text[i + 1] = 'B'
			i += 1
		i += 1
	m -= 1
print(''.join(text))


(count, time) = map(int, input().split())
data = list(input())
for j in range(time):
	i = 0
	while i < count:
		if i > 0 and data[i] == 'G' and (data[i - 1] == 'B'):
			(data[i - 1], data[i]) = (data[i], data[i - 1])
			i += 1
		i += 1
print(''.join(data))


(n, t) = map(int, input().split())
s = list(input())
while t > 0:
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
	t -= 1
print(''.join(s))


(n, t) = [int(j) for j in input().split()]
s = list(input())
for i in range(t):
	j = 1
	while j < n:
		if s[j] == 'G' and s[j - 1] == 'B':
			s[j] = 'B'
			s[j - 1] = 'G'
			j += 1
		j += 1
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
s_new = []
for i in range(n):
	s_new.append(s[i])
for _ in range(t):
	for i in range(1, n):
		if s[i] == 'G' and s[i - 1] == 'B':
			s_new[i - 1] = 'G'
			s_new[i] = 'B'
	for i in range(n):
		s[i] = s_new[i]
for i in range(n):
	print(s[i], sep='', end='')


(N, T) = map(int, input().split())
line = input()
for t in range(T):
	line = line.replace('BG', 'GB')
print(line)


(n, t) = map(int, input().split(' '))
queue = list(input())
for i in range(t):
	j = 1
	while j < n:
		if queue[-j] == 'G' and queue[-j - 1] == 'B':
			(queue[-j], queue[-j - 1]) = (queue[-j - 1], queue[-j])
			j += 2
		else:
			j += 1
print(''.join(queue))


(a, b) = map(int, input().split())
queue = input()
T = 1
for i in range(b):
	for j in range(a - 1):
		if queue[j] + queue[j + 1] == 'BG' and T:
			queue = queue[:j] + queue[j + 1] + queue[j] + queue[j + 2:]
			T = 0
			if j == a - 2:
				T = 1
		else:
			T = 1
			continue
print(queue)


(n, t) = [int(x) for x in input().split(' ')]
queue = input()
for i in range(t):
	if 'BG' in queue:
		queue = queue.replace('BG', 'GB')
	else:
		break
print(queue)


(n, k) = [int(i) for i in input().split(' ')]
l = input()
for i in range(0, k):
	l = l.replace('BG', 'GB')
print(l)


from sys import stdin

def sol(queue, times):
	for i in range(times):
		queue = queue.replace('BG', 'GB')
	return queue
(size, times) = map(int, stdin.readline().split())
queue = stdin.readline().strip()
print(sol(queue, times))


(n, t) = map(int, input().split(' '))
line = list(map(str, input()))
curT = 0
while curT < t:
	i = 0
	while i < n:
		if line[i] == 'B' and i != n - 1 and (line[i + 1] == 'G'):
			line[i] = 'G'
			line[i + 1] = 'B'
			i += 2
		else:
			i += 1
	curT += 1
print(''.join(line))


(n, t) = map(int, input().split())
s = input()
a = []
while t > 0:
	i = 0
	while i < n:
		if i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				a.append('G')
				a.append('B')
				i += 1
			else:
				a.append(s[i])
			i += 1
		else:
			a.append(s[i])
			break
	s = a
	a = []
	t -= 1
for i in s:
	print(i, end='')


(n, t) = [int(x) for x in input().split()]
queue = list(input())
queue2 = []
for _ in range(t):
	i = 0
	while i < len(queue):
		if queue[i] == 'B':
			try:
				if queue[i + 1] == 'G':
					queue2.append('G')
					queue2.append('B')
					i += 2
				else:
					queue2.append('B')
					i += 1
			except IndexError:
				queue2.append('B')
				i += 1
		else:
			queue2.append('G')
			i += 1
	queue = queue2
	queue2 = []
output = ''.join(queue)
print(output)


def Solve(s, t):
	s = list(s)
	while t > 0:
		i = 1
		while i < len(s):
			if s[i] == 'G' and s[i - 1] == 'B':
				(s[i], s[i - 1]) = (s[i - 1], s[i])
				i += 1
			i += 1
		t -= 1
	print(''.join(s))
(n, t) = map(int, input().split())
s = str(input())
Solve(s, t)


(number, seconds) = input().split(' ')
(number, seconds) = (int(number), int(seconds))
queue = input()

def capitalise(lis):
	newlis = []
	for letter in lis:
		newlis.append(letter.upper())
	return newlis
lis = [char for char in queue]
for second in range(seconds):
	for person in range(len(lis) - 1):
		if lis[person] == 'B' and lis[person + 1] == 'G':
			lis[person] = 'g'
			lis[person + 1] = 'b'
	lis = capitalise(lis)
print(''.join(lis))


def switch(a, s):
	lt = list(s)
	x = lt[a]
	lt[a] = lt[a + 1]
	lt[a + 1] = x
	return ''.join(lt)
(a, b) = map(int, input().split())
s = input()
t = 0
i = 0
for j in range(b):
	i = 0
	while i <= a - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			s = switch(i, s)
			i = i + 2
		else:
			i = i + 1
print(s)


(n, t) = [int(elem) for elem in input().split(' ')]
s = input()
for _ in range(t):
	res = ''
	i = 0
	while i < n:
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			res += 'GB'
			i += 1
		else:
			res += s[i]
		i += 1
	s = res
print(s)


inline = input().split(' ')
n = int(inline[0])
t = int(inline[1])
string = input()
while t > 0:
	for (index, c) in enumerate(string):
		if index != n - 1 and (c == 'B' and string[index + 1] == 'G'):
			new = list(string)
			new[index] = 'G'
			new[index + 1] = 'B'
			string = ''.join(new)
	t -= 1
print(string)


num_order_list = input().split()
n_child = int(num_order_list[0])
seconds = int(num_order_list[1])
order_list = list(input())
i = 0
for t in range(seconds):
	while i <= n_child - 1 and i + 1 <= n_child - 1:
		if order_list[i] == 'B' and order_list[i + 1] == 'G':
			(order_list[i], order_list[i + 1]) = (order_list[i + 1], order_list[i])
			i += 2
		else:
			i += 1
	i = 0
print(''.join(order_list))


[n, t] = [int(a) for a in input().split(' ')]
queue = list(input())
while t > 0:
	count = 0
	while count < n - 1:
		p = queue[count]
		if p == 'B' and queue[count + 1] == 'G':
			queue[count] = 'G'
			queue[count + 1] = 'B'
			count += 1
		count += 1
	t = t - 1
print(''.join(queue))


(n, t) = map(int, input().split())
l = list(input())
c = 0
i = 0
while c < t:
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 2
		else:
			i += 1
	c += 1
	i = 0
for i in l:
	print(i, end='')


import sys
import math

def main():
	(n, t) = map(int, sys.stdin.readline().strip().split()[:2])
	s = sys.stdin.readline().strip()
	for i in range(t):
		s = s.replace('BG', 'GB')
	print(s)
main()


(a, n) = [int(i) for i in input().split()]
b = input()
for i in range(n):
	b = b.replace('BG', 'GB')
print(b)


a = input().split()
n = int(a[0])
t = int(a[1])
s = input()
s1 = []
for i in s:
	s1.append(i)
for i in range(0, t):
	flag = False
	for j in range(0, n - 1):
		if flag:
			flag = False
			continue
		if s1[j] == 'B' and s1[j + 1] == 'G':
			(s1[j], s1[j + 1]) = (s1[j + 1], s1[j])
			flag = True
s = ''
for i in s1:
	s += i
print(s)


(n, s) = map(int, input().split())
li = input()
while s:
	li = li.replace('BG', 'GB')
	s -= 1
print(li)


def main():
	(n, t) = list(map(int, input().split()))
	q = list(input())
	while t > 0:
		i = 0
		while i < n - 1:
			if q[i] == 'B' and q[i + 1] == 'G':
				q[i] = 'G'
				q[i + 1] = 'B'
				i += 1
			i += 1
		t -= 1
	out = ''
	out = out.join(q)
	print(out)
main()


(n, t) = map(int, input().split())
a = list(input())
b = a[:]
for i in range(t):
	for j in range(len(a) - 1):
		if a[j] == 'B' and a[j + 1] == 'G':
			b[j + 1] = 'B'
			b[j] = 'G'
	a = b[:]
print(''.join(a))


(a, b) = map(int, input().split())
st = input()
st = list(st)

def fun(x, y, string):
	for i in range(y):
		j = 0
		while j < x - 1:
			if string[j] == 'B' and string[j] != string[j + 1]:
				string[j] = 'G'
				string[j + 1] = 'B'
				j += 2
			else:
				j += 1
	print(''.join(string))
fun(a, b, st)


def switchBG(idx):
	idx = idx
	del queue[idx]
	queue.insert(idx + 1, 'B')
	return
(n, t) = map(int, input().split())
queue = list(input())
Flag = False
for i in range(t):
	Flag = False
	for j in range(n - 1):
		if Flag:
			Flag = False
			continue
		elif queue[j] == 'B' and queue[j + 1] == 'G':
			switchBG(j)
			Flag = True
		else:
			Flag = False
print(''.join(queue))


vars = [int(i) for i in input().split()]
numbers = vars[0]
time = vars[1]
children = input()
list_ch = list(children)
for t in range(time):
	indx = 0
	while indx != numbers - 1:
		if list_ch[indx] == 'G':
			indx += 1
		elif list_ch[indx] == 'B' and list_ch[indx + 1] == 'B':
			indx += 1
		else:
			list_ch[indx] = 'G'
			list_ch[indx + 1] = 'B'
			if indx == numbers - 2:
				indx += 1
			else:
				indx += 2
children = ''.join(list_ch)
print(children)


inputz = input().split()
n = int(inputz[0])
t = int(inputz[1])
q = input()
for i in range(t):
	for i in range(n - 1):
		if q[i] == 'B' and q[i + 1] == 'G':
			q = q[0:i] + 'G' + 'b' + q[i + 1 + 1:]
	q = q.upper()
print(q)


val = list(map(int, input().split(' ')))
string = list(input())
i = 0
for j in range(val[1]):
	i = 0
	while i <= val[0] - 2:
		if string[i] < string[i + 1]:
			(string[i], string[i + 1]) = (string[i + 1], string[i])
			i += 1
		i += 1
print(''.join(string))


def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
l1 = invr()
time = next(l1)
time = next(l1)
l2 = insr()
nl2 = l2.copy()
for t in range(time):
	for x in range(len(l2) - 1):
		if l2[x] == 'B' and l2[x + 1] == 'G':
			nl2[x] = 'G'
			nl2[x + 1] = 'B'
	l2 = nl2.copy()
print(''.join(l2))


a = list(map(int, input().split(' ')))
b = input()
b = list(b)
for i in range(a[1]):
	j = 0
	while j < len(b):
		if b[j] == 'G' and j == 0:
			j = j + 1
		elif b[j] == 'G':
			(b[j], b[j - 1]) = (b[j - 1], b[j])
			j = j + 2
		else:
			j = j + 1
ch = ''
b = ch.join(b)
print(b)


import sys

def solver(text, t):
	text = list(text)
	for i in range(t):
		change(text)
	return ''.join(text)

def change(text):
	i = 0
	l = len(text)
	while i < l - 1:
		if text[i] == 'B' and text[i + 1] == 'G':
			(text[i], text[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1

def get_ints():
	return map(int, sys.stdin.readline().split())
(a, b) = get_ints()
tmp = str(sys.stdin.readline())
sys.stdout.write(solver(tmp, b))


(n, t) = map(int, input().split())
string = input().upper()
while t > 0:
	string = string.replace('BG', 'GB')
	t -= 1
print(string)


(x, y) = map(int, input().split())
z = input().upper()
for i in range(y):
	z = z.replace('BG', 'GB')
print(z)


(n, t) = map(int, input().split())
string = list(input())

def unsc(string):
	results = []
	for human in string.copy():
		if len(string) != 0:
			try:
				if string[0] == 'B' and string[1] == 'G':
					results.append(string.pop(1))
					if len(string) != 0:
						results.append(string.pop(0))
					continue
				else:
					results.append(string.pop(0))
					continue
			except IndexError:
				results.append(string.pop(0))
	else:
		return results
for time in range(1, t + 1):
	string = unsc(string)
else:
	results = ''
	for i in string:
		results += i
	else:
		print(results)


nt = list(map(int, input().split()))
s = input()
n = nt[0]
t = nt[1]
while t > 0:
	i = 0
	l = []
	while i < n:
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			l.append('G')
			l.append('B')
			i = i + 1
		else:
			l.append(s[i])
		i += 1
	s = l
	t -= 1
print(''.join((x for x in s)))


x = [int(i) for i in input().split()]
y = input()
n = 0
while n < x[1]:
	n += 1
	y = y.replace('BG', 'GB')
print(y)


(n, t) = map(int, input().split())
que = input()
que = list(que)
x = que.count('B')
for i in range(t):
	j = 0
	while j < n - 1:
		if que[j] == 'B' and que[j + 1] == 'G':
			que[j] = 'G'
			que[j + 1] = 'B'
			j = j + 2
		else:
			j = j + 1
print(''.join(que))


(n, t) = [int(x) for x in input().split(' ')]
string = [char for char in input()]
for _ in range(t):
	replaced = False
	for i in range(n - 1):
		if replaced:
			replaced = False
			continue
		if string[i] == 'B' and string[i + 1] == 'G':
			string[i] = 'G'
			string[i + 1] = 'B'
			replaced = True
for letter in string:
	print(letter, end='')


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	arr = ''
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			arr = arr + s[i + 1] + s[i]
		elif len(arr) < i + 1:
			arr = arr + s[i]
	if len(arr) < n:
		arr = arr + s[n - 1]
	s = arr
print(arr)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
(n, t) = mi()
q = si()
while t > 0:
	q = q.replace('BG', 'GB')
	t -= 1
print(q)


a = input()
a = list(map(int, a.split(' ')))
n = a[0]
t = a[1]
s = input()
ans = s
for i in range(t):
	s = ans
	ans = ''
	j = 0
	while True:
		if j == n - 1:
			ans += s[j]
			break
		if j > n - 1:
			break
		if s[j] == 'B' and s[j + 1] == 'G':
			ans += 'G'
			ans += 'B'
			j += 2
			continue
		ans += s[j]
		j += 1
print(ans)


(n, k) = list(map(int, input().split()))
s = list(' '.join(input()).split())
a = ''
for i in range(k):
	b = 0
	if b < len(s) - 1:
		for g in range(len(s)):
			if s[b] == 'B' and s[b + 1] == 'G':
				(s[b], s[b + 1]) = (s[b + 1], s[b])
				b += 2
			else:
				b += 1
			if b >= len(s) - 1:
				break
for i in s:
	a += i
print(a)


(amount, time) = input().split(' ')
amount = int(amount)
time = int(time)
line = input()
list_line = list(line)
for i in range(time):
	j = 0
	while j < len(list_line) - 1:
		if list_line[j] == 'B' and list_line[j + 1] == 'G':
			list_line[j] = 'G'
			list_line[j + 1] = 'B'
			j += 2
		else:
			j += 1
for i in list_line:
	print(i, end='')


n = [int(i) for i in input().split()]
a = input()
b = []
for i in a:
	b.append(i)
a = b
while n[1] >= 1:
	i = len(a) - 1
	while i >= 1:
		if a[i] == 'G':
			if a[i - 1] == 'B':
				a[i] = 'B'
				a[i - 1] = 'G'
				i = i - 2
				continue
		i = i - 1
	n[1] = n[1] - 1
for i in a:
	print(i, end='')


(n, t) = map(int, input().split())
arr = list(str(input()))
for sec in range(t):
	i = 0
	switch = []
	while i < len(arr) - 1:
		if not arr[i] == arr[i + 1]:
			if arr[i] == 'B' and arr[i + 1] == 'G':
				switch.append(i)
				i = i + 2
			else:
				i = i + 1
			if i > len(arr) - 1:
				break
		else:
			i = i + 1
	for i in switch:
		(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
print(*arr, sep='')


(n, t) = [int(_) for _ in input().split()]
s = list(input())
for _ in range(t):
	tmp = list(s)
	for j in range(1, len(s)):
		if s[j - 1] == 'B' and s[j] == 'G':
			tmp[j - 1] = 'G'
			tmp[j] = 'B'
	s = list(tmp)
print(''.join(s))


a = list(map(int, input().split(' ')))
b = input()
for _ in range(a[1]):
	if 'BG' not in b:
		break
	b = b.replace('BG', 'GB')
print(b)


def fd70000000():
	n_t = list(map(int, input().split()))
	n = n_t[0]
	t = n_t[1]
	s = input()
	s_out = ''
	for i in range(t):
		skipper = 0
		for j in range(len(s) - 1):
			if skipper:
				skipper = 0
				continue
			if s[j] == 'B' and s[j + 1] == 'G':
				s_out = s_out + 'GB'
				skipper = 1
			else:
				s_out = s_out + s[j]
		if not skipper:
			s_out = s_out + s[-1]
		s = s_out
		s_out = ''
	return print(s)
fd70000000()


(n, t) = map(int, input().split())
result = input().strip()
for _ in range(t):
	result = result.replace('BG', 'GB')
print(result)


(n, t) = map(int, input().split())
s = list(input().strip())
while t:
	i = 1
	while i < n:
		if s[i - 1] == 'B' and s[i] == 'G':
			(s[i - 1], s[i]) = (s[i], s[i - 1])
			i += 1
		i += 1
	t -= 1
print(''.join(s))


(n, t) = map(int, input().split())
s = str(input())
while t > 0:
	new = ''
	i = 0
	while i < n:
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			new += 'G' + 'B'
			i += 2
		else:
			new += s[i]
			i += 1
	t -= 1
	s = new
print(s)


(n, k) = map(int, input().split())
s = input()
a = []
for i in range(n):
	a.append(s[i])
for j in range(k):
	i = n - 2
	while i >= 0:
		if a[i + 1] == 'G' and a[i] == 'B':
			(a[i + 1], a[i]) = (a[i], a[i + 1])
			i -= 2
		else:
			i -= 1
for i in range(n):
	print(a[i], end='')


(n, t) = [int(i) for i in input().split()]
s = list(input())
for i in range(t):
	sawp = [0 for i in range(len(s))]
	for j in range(1, len(s)):
		if s[j - 1] == 'B' and s[j] == 'G':
			sawp[j] = 1
	for j in range(1, len(s)):
		if sawp[j] == 1:
			(s[j], s[j - 1]) = (s[j - 1], s[j])
for i in s:
	print(i, end='')


(x, y) = input().split()
x = int(x)
y = int(y)
q = input()
ppl = list(q)
i = 0
j = 1
while i < y:
	j = 1
	while j <= x - 1:
		if ppl[j] == 'G' and ppl[j - 1] == 'B':
			ppl[j] = 'B'
			ppl[j - 1] = 'G'
			j += 1
		j += 1
	i += 1
print(''.join(ppl))


(m, n) = [int(x) for x in input().split()]
a = input()
for i in range(n):
	a = a.replace('BG', 'GB')
print(a)


(n, k) = map(int, input().split())
s = input()
for i in range(k):
	if s.count('BG') != 0:
		s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
s = list(input())
for j in range(t):
	a = []
	for i in range(1, n):
		if s[i] == 'G' and s[i - 1] == 'B':
			a.append(i)
	for i in a:
		(s[i], s[i - 1]) = (s[i - 1], s[i])
print(''.join(s))


user_input = input().split()
n = int(user_input[0])
k = int(user_input[1])
seq_1 = list(input())
seq_2 = seq_1[:]
for x in range(k):
	for y in range(len(seq_1) - 1):
		if seq_1[y] == 'B' and seq_1[y + 1] == 'G':
			(seq_2[y], seq_2[y + 1]) = (seq_2[y + 1], seq_2[y])
	seq_1 = seq_2[:]
holder = ''
print(holder.join(seq_1))


def move(a, k):
	for i in range(k):
		num_boy = 0
		while num_boy in range(len(a) - 1):
			if a[num_boy] == 'B' and a[num_boy + 1] == 'G':
				a.pop(num_boy + 1)
				a.pop(num_boy)
				a.insert(num_boy, 'G')
				a.insert(num_boy + 1, 'B')
				num_boy += 2
			else:
				num_boy += 1
	return a
num = input()
rowtime = [int(n) for n in num.split()]
row = list(input())
new = move(row, rowtime[1])
ans = ''
for i in range(rowtime[0]):
	ans += new[i]
print(ans)


(n, t) = map(int, input().split())
arr = list(input().strip())
for x in range(0, t):
	indices = [i for (i, x) in enumerate(arr) if x == 'B']
	for y in range(0, len(indices)):
		index = indices[y]
		if index + 1 < len(arr) and arr[index + 1] != 'B':
			(arr[index], arr[index + 1]) = (arr[index + 1], arr[index])
print(''.join((n for n in arr)))


def main():
	a = input().split(' ')
	a = [int(x) for x in a]
	line = input()
	for x in range(0, a[1]):
		temp = line.replace('BG', 'GB')
		line = temp
	print(line)
main()


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def make(name, x):
	name1 = list(name)
	name2 = list(name)
	for j in range(1, x):
		if name2[j - 1] == 'B' and name2[j] == 'G':
			name1[j] = 'B'
			name1[j - 1] = 'G'
	name = ''.join(name1)
	return name
x = read_array()
y = x[1]
name = input()
for i in range(y):
	name = make(name, x[0])
print(name)


import re
(x, y) = input().split()
y = int(y)
s = input()
while y > 0:
	a = re.sub('BG', 'GB', s)
	s = a
	y -= 1
print(a)


l = input().split()
n = int(l[0])
t = int(l[1])
string = input()
for x in range(t):
	i = 0
	newstring = ''
	while i < n:
		if i == n - 1:
			newstring += string[i]
			i += 1
		elif string[i] == 'B' and string[i + 1] == 'G':
			newstring += 'GB'
			i += 2
		elif string[i + 1] == 'B':
			newstring += string[i]
			i += 1
		else:
			newstring += string[i] + string[i + 1]
			i += 2
	string = newstring
print(newstring)


(n, t) = [int(x) for x in input().split()]
seq = input()
changes = True
i = 0
while changes and i < t:
	i += 1
	j = 0
	changes = False
	while j < len(seq) - 1:
		if seq[j] == 'B' and seq[j + 1] == 'G':
			seq = seq[:j] + 'GB' + seq[j + 2:]
			j += 1
			changes = True
		j += 1
print(seq)


a = input()
a = [int(i) for i in a.split(' ')]
b = input()
n = ''
b = [i for i in b]
for repet in range(a[1]):
	index_b = []
	for i in range(len(b) - 1):
		if b[i] == 'B':
			index_b.append(i)
	index_bg = []
	for j in index_b:
		if b[j + 1] == 'G':
			index_bg.append(j)
	for k in index_bg:
		b[k] = 'G'
		b[k + 1] = 'B'
print(''.join(b))


(n, t) = map(int, input().split())
l = list(input())
for i in [0] * t:
	d = [0] * n
	d[0] = l[0]
	for p in range(1, n):
		if l[p - 1] == 'B' and l[p] == 'G':
			d[p - 1] = 'G'
			d[p] = 'B'
		else:
			d[p] = l[p]
	l = d
print(''.join(d))


(a, b) = tuple(map(int, input().split()))
c = input()
c = list(c)
for i in range(b):
	indices = [i for i in range(a) if c[i] == 'B']
	for i in indices:
		if i < a - 1:
			if c[i + 1] == 'G':
				(c[i], c[i + 1]) = (c[i + 1], c[i])
			else:
				continue
		else:
			break
e = ''
print(e.join(c))


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = input()
c = list(c)
pos = 0
for i in range(b):
	pos = 0
	while True:
		if pos >= a:
			break
		if pos < a - 1 and c[pos] == 'B' and (c[pos + 1] == 'G'):
			c[pos] = 'G'
			c[pos + 1] = 'B'
			pos += 2
		else:
			pos += 1
c = ''.join([str(elem) for elem in c])
print(c)


(n, k) = map(int, input().split())
s = input()
s = list(s)
i = 0
for kth in range(k):
	j = 0
	for i in range(n):
		if j < n - 1 and s[j] == 'B' and (s[j + 1] == 'G'):
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			ans = ''.join(s)
			j += 1
		j += 1
ss = ''.join(s)
print(ss)


(n, t) = [int(x) for x in input().split()]
string = input()
for x in range(t):
	if n == 1:
		break
	else:
		string = string.replace('BG', 'GB')
print(string)


(n, t) = map(int, input().split())
s = input()
s2 = s
for i in range(t):
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			s2 = s2[:j] + 'G' + s2[j + 1:]
			s2 = s2[:j + 1] + 'B' + s2[j + 2:]
	s = s2
print(s)


(n, t) = map(int, input().split())
strr = list(input())
flag = False
for x in range(0, t):
	flag = False
	for y in range(n - 1):
		if flag:
			flag = False
			continue
		if strr[y] == 'B' and strr[y + 1] == 'G':
			(strr[y], strr[y + 1]) = (strr[y + 1], strr[y])
			flag = True
print(''.join(strr))


num = input().split()
a = int(num[0])
b = int(num[1])
x = 0
line = list(input())
line2 = []
for i in range(a):
	line2.append(line[i])
while x < b:
	x += 1
	for i in range(a - 1):
		if line[i] == 'B' and line[i + 1] == 'G':
			line2[i] = 'G'
			line2[i + 1] = 'B'
	for i in range(a):
		line[i] = line2[i]
print(''.join(line2))


(n, t) = [int(n) for n in input().split(' ')]
input = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if input[j] == 'B' and input[j + 1] == 'G':
			temp = input[j]
			input[j] = input[j + 1]
			input[j + 1] = temp
			j = j + 1
		j = j + 1
for x in input:
	print(x, end='')


(l, s) = (int(i) for i in input().split())
q = list(input())
for i in range(s):
	p = 0
	while p < l - 1:
		if q[p] == 'B' and q[p + 1] == 'G':
			(q[p], q[p + 1]) = (q[p + 1], q[p])
			p += 2
		else:
			p += 1
print(''.join((str(i) for i in q)))


(n, t) = [int(x) for x in input().split()]
line = input()
for i in range(t):
	bg = line.find('BG')
	while bg != -1 and bg <= n - 2:
		line = line[0:bg] + line[bg + 1] + line[bg] + line[bg + 2:]
		bg = line.find('BG', bg + 2)
print(line)


(length, second) = map(int, input().split())
queue = list(input())
j = 0
i = 0
while i < second:
	while j < length - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			temp = queue[j]
			queue[j] = queue[j + 1]
			queue[j + 1] = temp
			j += 1
		j += 1
	j = 0
	i += 1
new_queue = ''
for i in queue:
	new_queue += i
print(new_queue)


from sys import stdin

def main():
	(x, y) = [int(c) for c in stdin.readline().split()]
	cade = list(stdin.readline().strip())
	for i in range(y):
		t = 0
		while t < len(cade) - 1:
			if cade[t] == 'B' and cade[t + 1] == 'G':
				(cade[t], cade[t + 1]) = (cade[t + 1], cade[t])
				t += 1
			t += 1
	print(''.join(cade))
main()


a = list(map(int, input().split()))
(n, t) = (a[0], a[1])
b = input()
c = []
for i in range(n):
	c.append(b[i])
for i in range(t):
	d = []
	for j in range(n):
		if c[j] == 'B':
			d.append(j)
	for k in range(len(d)):
		if d[k] == n - 1:
			d[k] == d[k]
		elif c[d[k] + 1] == 'G':
			a = c[d[k]]
			c[d[k]] = c[d[k] + 1]
			c[d[k] + 1] = a
for l in c:
	print(l, end='')


import re
(_, seconds) = list(map(int, str(input()).split(' ')))
queue = str(input())
for i in range(seconds):
	queue2 = re.sub('BG', 'GB', queue)
	if queue2 == queue:
		break
	queue = queue2
print(queue)


(a, b) = list(map(int, input().split()))
s = list(input())
for i in range(b):
	j = a - 1
	while j > 0:
		if s[j - 1] == 'B' and s[j] == 'G':
			(s[j - 1], s[j]) = (s[j], s[j - 1])
			j -= 2
		else:
			j -= 1
print(*s, sep='')


(n, t) = [int(x) for x in input().split()]
a = list(input())
for i in range(t):
	b = []
	for k in range(n - 1):
		if a[k] == 'B':
			b.append(k)
	for j in b:
		if a[j + 1] == 'G':
			a[j] = 'G'
			a[j + 1] = 'B'
print(''.join(a))


(s, sec) = map(int, input().split())
crowd = [i for i in input()]
for _ in range(sec):
	boys = []
	for i in range(len(crowd)):
		if crowd[i] == 'B':
			boys.append(i)
	for i in boys:
		try:
			if crowd[i + 1] == 'G':
				(crowd[i + 1], crowd[i]) = (crowd[i], crowd[i + 1])
		except:
			pass
print(*crowd, sep='')


(n, t) = [int(i) for i in input().split()]
queue = list(input())
for i in range(t):
	queue_new = list(queue)
	for j in range(n - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue_new[j], queue_new[j + 1]) = (queue_new[j + 1], queue_new[j])
	queue = list(queue_new)
print(''.join(queue))


try:
	(n, t) = map(int, input().split())
	s = input()
	for i in range(t):
		output = ''
		for (j, value) in enumerate(s):
			if j + 1 < n and (value == 'B' and s[j + 1] == 'G'):
				output += 'G'
			elif output != '' and output[-1] == 'G' and (s[j - 1] == 'B'):
				output += 'B'
			else:
				output += value
		s = output
	print(s)
except EOFError as identifier:
	pass


(n, t) = map(int, input().split())
queue = list(input())
for i in range(0, t):
	index = 0
	while index < len(queue) - 1:
		if queue[index] == 'B' and queue[index + 1] == 'G':
			(queue[index], queue[index + 1]) = ('G', 'B')
			index += 1
		index += 1
print(''.join(queue))


def getIntData():
	return list(map(int, input().split()))
(n, t) = getIntData()
Queue = list(map(str, input()))
boysLst = []

def BG(string):
	for i in range(n):
		if string[i] == 'B' and i != n - 1:
			if string[i + 1] == 'G':
				boysLst.append(i)
		else:
			continue

def swap(lst):
	a = len(lst)
	if a != 0:
		for i in range(a):
			(Queue[lst[i]], Queue[lst[i] + 1]) = (Queue[lst[i] + 1], Queue[lst[i]])

def iterSwap(lst):
	for j in range(t):
		lst.clear()
		BG(Queue)
		swap(lst)
iterSwap(boysLst)
print(''.join(Queue))


(n, t) = map(int, input().split())
s = list(input())
while t > 0:
	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 += 1
		i += 1
	t -= 1
print(*s, sep='')


(n, t) = (int(x) for x in input().split())
seq = list(input())
p = 0
while t:
	cnt = 0
	while p < n and seq[p] == 'G':
		p += 1
	i = p
	while i < n - 1:
		if seq[i] == 'B' and seq[i + 1] == 'G':
			seq[i] = 'G'
			seq[i + 1] = 'B'
			i += 2
		else:
			i += 1
	p += cnt
	t -= 1
print(''.join(seq))


(n, t) = map(int, input().split())
s1 = ''
s2 = ''
s = input()
for j in range(t):
	s = s.replace('BG', 'GB')
print(s)


numbers = [int(n) for n in input().split()]
children = numbers[0]
time = numbers[1]
queue = list(input())
empty = ''
for i in range(time):
	i = 0
	while i != len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			if i + 2 < len(queue):
				i += 2
			else:
				i += 1
		else:
			i += 1
for i in range(len(queue)):
	empty += queue[i]
print(empty)


(n, t) = list(map(int, input().split()))
q = list(input())
for ti in range(t):
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			i += 1
		i += 1
if q[n - 1] == 'G':
	(q[n - 1], q[n - 2]) = (q[n - 2], q[n - 1])
print(''.join(q))


(n, t) = [int(x) for x in input().split()]
students = list(input())
is_swap = False
for _ in range(t):
	i = n - 1
	while i > 0:
		if students[i] == 'G' and students[i - 1] == 'B':
			is_swap = True
			(students[i], students[i - 1]) = ('B', 'G')
			i -= 2
			continue
		i -= 1
	if not is_swap:
		break
	is_swap = False
print(''.join(students))


(a, b) = map(int, input().split())
w = list(input())
while b > 0:
	b -= 1
	for n in range(0, a - 1):
		if w[n] == 'B':
			if w[n + 1] == 'G':
				w[n] = 'G'
				w[n + 1] = 'A'
	for n in range(0, a):
		if w[n] == 'A':
			w[n] = 'B'
for i in range(0, a):
	print(w[i], end='')


(n, t) = tuple(map(int, input().split()))
word = input()
for i in range(t):
	word = word.replace('BG', 'GB')
print(word)


(n, t) = map(int, input().split())
queue = input()
new = queue
for i in range(t):
	for j in range(len(queue) - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			temp = new[j + 1]
			trailer = new[j + 1 + 1:] if j + 1 + 1 < len(new) else ''
			new = new[0:j + 1] + new[j] + trailer
			new = new[0:j] + temp + new[j + 1:]
	queue = new
print(new)


(n, t) = map(int, input().split())
str1 = str(input())
for i in range(t):
	str1 = str1.replace('BG', 'GB')
print(str1)


(size, time) = map(int, input().split(' '))
string = input()
length = len(string)
my_list = [a for a in string]
while time > 0:
	i = 0
	while i < size - 1:
		if my_list[i] == 'B' and my_list[i + 1] == 'G':
			my_list[i + 1] = 'B'
			my_list[i] = 'G'
			i = i + 2
		else:
			i = i + 1
	time -= 1
x = ''.join(my_list)
print(x.strip())


a = [int(x) for x in input().split(' ')]
n = a[0]
t = a[1]
s = input()
for i in range(0, t):
	s = s.replace('BG', 'GA')
	s = s.replace('GA', 'GB')
print(s)


import copy
(n, t) = list(map(int, input().split()))
L = list(input())
L1 = copy.deepcopy(L)
for i in range(t):
	for i in range(n - 1):
		if L[i] == 'B' and L[i + 1] == 'G':
			(L1[i], L1[i + 1]) = (L1[i + 1], L[i])
	L = copy.deepcopy(L1)
print(''.join(L))


(n, t) = [int(x) for x in input().split()]
a = 0
s = input()
m = s
while a < t:
	a += 1
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			m = m[0:i] + 'GB' + m[i + 2:n]
	s = m
print(s)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	cand = []
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			cand.append(j)
	for j in cand:
		s = s[:j] + s[j + 1] + s[j] + s[j + 2:]
print(s)


(size, time) = map(int, input().split())
positions = list(input())
while time > 0:
	ptr = size - 1
	while ptr > 0:
		if positions[ptr] == 'G' and positions[ptr - 1] == 'B':
			(positions[ptr], positions[ptr - 1]) = (positions[ptr - 1], positions[ptr])
			ptr -= 1
		ptr -= 1
	time -= 1
print(''.join(positions))


(l, a) = map(int, input().split())
b = input()
n = 0
for i in range(a):
	b = b.replace('BG', 'GB')
print(b)


(n, t) = map(int, input().split())
data = input()
x = 0
while x != t:
	check = []
	for i in range(1, n):
		if data[i] == 'G' and data[i - 1] == 'B' and (i - 1 not in check):
			data = data[:i - 1] + data[i - 1:i + 1][::-1] + data[i + 1:]
			check.append(i)
	x += 1
print(data)


from collections import defaultdict
import math
(n, t) = map(int, input().split())
a = input()
for _ in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a = a[:i] + 'GB' + a[i + 2:]
			i += 1
		i += 1
print(a)


from math import *

def main():
	(n, t) = map(int, input().split())
	s = input()
	for i in range(t):
		temp = list(s)
		for c in range(n - 1):
			if s[c] == 'B' and s[c + 1] == 'G':
				temp[c] = 'G'
				temp[c + 1] = 'B'
		s = ''.join(temp)
	print(s)
main()


nums = list(map(int, input().split()))
s = list(input())
(n, t) = (nums[0], nums[1])
switched = False
for z in range(t):
	switched = False
	for x in range(n - 1):
		if switched:
			switched = False
		elif s[x] == 'B' and s[x + 1] == 'G' and (not switched):
			s[x] = 'G'
			s[x + 1] = 'B'
			switched = True
print(''.join(s))


(n, t) = map(int, input().split())
arr = list(input())
while t:
	i = 0
	while i < n - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
			i += 1
		i += 1
	t -= 1
print(''.join(arr))


g = input()
(n, t) = [int(x) for x in g.split()]
order = input()
listing = []
listing.extend(order)
while t > 0:
	for i in range(n - 1):
		if listing[i] == 'B' and listing[i + 1] == 'G':
			listing[i] = 'girl'
			listing[i + 1] = 'boy'
	for i in range(n):
		if listing[i] == 'girl':
			listing[i] = 'G'
		elif listing[i] == 'boy':
			listing[i] = 'B'
	t = t - 1
r = ''
for i in range(n):
	r = r + listing[i]
print(r)


import sys
input = sys.stdin.readline
numbers = input().strip().split(' ')
num_children = int(numbers[0])
time = int(numbers[1])
queue_str = input().strip()
queue = [x for x in queue_str]
for i in range(time):
	pos = 0
	while pos < num_children - 1:
		if queue[pos] == 'B' and queue[pos + 1] == 'G':
			(queue[pos], queue[pos + 1]) = (queue[pos + 1], queue[pos])
			pos += 1
		pos += 1
print(''.join(queue))


res = [int(n) for n in input().split()]
string = input()
l = list(string)
while res[1] > 0:
	for i in range(len(string) - 1):
		if string[i] == 'B' and string[i + 1] == 'G':
			temp = l[i]
			l[i] = l[i + 1]
			l[i + 1] = temp
	res[1] = res[1] - 1
	string = ''.join(l)
print(''.join(l))


(n, t) = map(int, input().split())
a = [] * n
for i in input():
	a.append(i)
i = 1
while t:
	t -= 1
	while i < n:
		if a[i] == 'G' and a[i - 1] == 'B':
			a[i] = 'B'
			a[i - 1] = 'G'
			i += 2
		else:
			i += 1
	i = 1
for i in a:
	print(i, sep='', end='')


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
firstIn = list(invr())
lineLen = firstIn[0]
time = firstIn[1]
iniLine = insr()
for x in range(time):
	i = 0
	while i < lineLen - 1:
		if iniLine[i] == 'B' and iniLine[i + 1] == 'G':
			iniLine[i] = 'G'
			iniLine[i + 1] = 'B'
			i += 2
		else:
			i += 1
newString = ''
for s in iniLine:
	newString += s
print(newString)


s = input
(t, t) = s().split()
a = s()
for i in ' ' * int(t):
	a = a.replace('BG', 'GB')
print(a)


entry_1 = input().split(' ')
first = int(entry_1[0])
second = int(entry_1[1])
entry = list(input().strip(''))
for i in range(second):
	res = entry
	indices = [t for (t, x) in enumerate(res) if x == 'B']
	for j in range(len(indices)):
		if indices[j] != first - 1:
			if res[indices[j] + 1] == 'G':
				res[indices[j]] = 'G'
				res[indices[j] + 1] = 'B'
			else:
				continue
sol = ''
for i in res:
	sol += i
print(sol)


(n, t) = map(int, input().split())
r = input()
ar = list(r)

def change(ar, n):
	i = 0
	while i < n:
		if ar[i] == 'B':
			if i < n - 1 and ar[i + 1] == 'G':
				ar[i] = 'G'
				ar[i + 1] = 'B'
				i += 1
		i += 1
for i in range(t):
	change(ar, n)
print(*ar, sep='')


(n, t) = map(int, input().split())
q = list(input())
for x in range(t):
	tab = []
	for y in range(n - 1):
		if q[y] == 'B':
			if q[y + 1] == 'G':
				tab.append(y)
	for x in range(len(tab)):
		(q[tab[x]], q[tab[x] + 1]) = (q[tab[x] + 1], q[tab[x]])
print(''.join(q))


(n, t) = map(int, input().split())
l = list(input())
while t > 0:
	x = 0
	m = []
	while x < n:
		if x == n - 1:
			m.append(l[x])
			x += 1
		elif not (l[x] == 'B' and l[x + 1] == 'G'):
			m.append(l[x])
			x += 1
		else:
			m.append(l[x + 1])
			m.append(l[x])
			x += 2
	t += -1
	l = m
print(''.join(l))


(n, m) = [int(x) for x in input().split()]
str2 = input()
str1 = list(str2)
for i in range(0, m):
	k = 0
	for j in range(k, len(str1) - 1):
		if str1[j] == 'B' and str1[j + 1] == 'G':
			str1[j] = 'G'
			str1[j + 1] = 'C'
	for j in range(0, len(str1)):
		if str1[j] == 'C':
			str1[j] = 'B'
for i in range(0, len(str1)):
	print(str1[i], end='')


(n, t) = map(int, input().split())
s = list(input())
flag = 0
for i in range(t):
	for x in range(n - 1):
		if flag == 1:
			flag = 0
			continue
		elif s[x] == 'B' and s[x + 1] == 'G':
			(s[x], s[x + 1]) = ('G', 'B')
			flag = 1
	flag = 0
print(''.join(s))


(n, t) = map(int, input().split())
l = input()
for i in range(t):
	x = 0
	for j in range(n - 1):
		if l[j] == 'B' and l[j + 1] == 'G' and (x == 0):
			l = l[:j] + l[j + 1] + l[j] + l[j + 2:]
			x = 1
		else:
			x = 0
print(l)


N = [int(x) for x in input().split()]
S = list(input())

def rearrange(s):
	e = list()
	for n in range(len(s) - 1):
		if s[n] + s[n + 1] == 'BG':
			e.append(n)
	if len(e) > 0:
		for n in e:
			s[n] = 'G'
			s[n + 1] = 'B'
	return s
for x in range(N[1]):
	rearrange(S)
print(''.join(S))


(n, t) = list(map(int, input().split(' ')))
seq = list(input())
for i in range(t):
	k = []
	for j in range(n - 1):
		if seq[j] == 'B' and seq[j + 1] == 'G':
			k.append(j)
	for j in k:
		temp = seq[j]
		seq[j] = seq[j + 1]
		seq[j + 1] = temp
print(''.join(seq))


import sys
(n, t) = map(int, input().split())
a = list(input())
for j in range(t):
	passer = 0
	for i in range(n - 1):
		if a[i] == 'B' and a[i + 1] == 'G' and (passer == 0):
			a[i] = 'G'
			a[i + 1] = 'B'
			passer = 1
		elif passer == 1:
			passer = 0
print(''.join(a))


def c(a):
	a = str(a)
	d = list(a)
	b = a.count('BG')
	c = a.find('BG')
	while b > 0:
		d[c] = 'G'
		d[c + 1] = 'B'
		c = a.find('BG', c + 1)
		b -= 1
	e = ''
	while b < len(a):
		e += str(d[b])
		b += 1
	return e
a = list(map(int, input().split()))
b = input()
while a[1] > 0:
	b = c(b)
	a[1] -= 1
print(b)


(n, t) = [int(i) for i in input().split()]
inp = list(input())
for _ in range(t):
	can_move = set()
	for i in range(n - 1):
		if inp[i] == 'B' and inp[i + 1] == 'G':
			if i not in can_move:
				(inp[i], inp[i + 1]) = (inp[i + 1], inp[i])
				can_move.add(i + 1)
print(''.join(inp))


def onesec(array):
	each = 0
	while each < len(array) - 1:
		current = array[each]
		nxt = array[each + 1]
		if current == 'B' and nxt == 'G':
			(array[each], array[each + 1]) = (array[each + 1], array[each])
			each += 2
		else:
			each += 1
	return array
info = input()
info = int(info.split(' ')[-1])
array = input()
array = [now for now in array]
for every in range(0, info):
	array = onesec(array)
out = ''
for each in array:
	out += each
print(out)


def _266B(line, t):
	for iteration in range(t):
		index = 1
		while index < len(line):
			if line[index] == 'G' and line[index - 1] == 'B':
				line[index] = 'B'
				line[index - 1] = 'G'
				index += 2
			else:
				index += 1
	return line
(n, t) = list(map(lambda x: int(x), input().split()))
line = list(input())
print(''.join(_266B(line, t)))


t = tuple((int(i) for i in input().split()))
q = [str(i) for i in input()]

def _repBG(l):
	s = ''.join(l)
	c = s.count('BG')
	if c != 0:
		z = s.index('BG')
		l[z] = 'G'
		l[z + 1] = 'B'
		return l[:z + 2] + _repBG(l[z + 2:])
	else:
		return l
for i in range(1, t[1] + 1):
	q = _repBG(q)
print(*q, sep='')


(numbOfKids, seconds) = [int(a) for a in input().split()]
order = list(input())
count = 1
for second in range(seconds):
	while count < numbOfKids:
		if order[count] == 'G' and order[count - 1] == 'B':
			(order[count], order[count - 1]) = ('B', 'G')
			count += 1
		count += 1
	count = 1
print(''.join(order))


(n, p) = map(int, input().split()[:2])
s = input()[:n]
l = list(s)
for i in range(p):
	k = 1
	while k < n:
		if l[k] == 'G' and l[k - 1] == 'B':
			l[k] = 'B'
			l[k - 1] = 'G'
			k = k + 1
		k = k + 1
print(''.join(l))


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
(a, b) = rinput()
l = input()
l1 = list(l)
for i in range(b):
	j = 0
	while j < a - 1:
		if l1[j] == 'B' and l1[j + 1] == 'G':
			l1[j] = 'G'
			l1[j + 1] = 'B'
			j += 2
		else:
			j = j + 1
ans = ''.join(l1)
print(ans)


x = [int(b) for b in input().split()]
y = input()
y = list(y)
c = y[:]
s = ''
for i in range(x[1]):
	for i in range(len(y) - 1):
		if y[i] == 'B' and y[i + 1] == 'G':
			(c[i], c[i + 1]) = (c[i + 1], c[i])
	y = c[:]
print(s.join(c))


(n, t) = map(int, input().split())
s = input()
a = list(s)
while t > 0:
	i = 0
	while i < n - 1:
		if a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i = i + 2
		else:
			i = i + 1
	t = t - 1
b = ''
for i in a:
	b += i
print(b)


import copy
(a, b) = input().split()
a = int(a)
b = int(b)
c = input()
c = list(c)
c1 = copy.deepcopy(c)
for h in range(b):
	for i in range(a - 1):
		if c[i] == 'B' and c[i + 1] == 'G':
			c1[i] = 'G'
			c1[i + 1] = 'B'
	c = copy.deepcopy(c1)
d = ''
for i in c:
	d += i
print(d)


def swap(a, b, c):
	z = a[b]
	a[b] = a[c]
	a[c] = z
	return a

def swap2(a, b, c):
	a1 = ''
	for i in range(len(a)):
		if i == b:
			a1 = a1 + a[c]
		elif i == c:
			a1 = a1 + a[b]
		else:
			a1 = a1 + a[i]
	return a1
(n, t) = [int(i) for i in input().split()]
a = input()
t = t
b = 'B'
g = 'G'
x = ''
for i in range(t):
	x = ''
	for i in range(0, n):
		if a[i] == g:
			if i == 0:
				x = x + g
			elif a[i - 1] == g:
				x = x + g
		elif i == n - 1:
			x = x + b
		elif a[i + 1] == b:
			x = x + b
		else:
			x = x + g
			x = x + b
	a = x
print(a)


from functools import reduce
(m, n) = map(int, input().split())
s = list(input())
t = s.copy()
for i in range(n):
	l = t.copy()
	for x in range(len(l)):
		if x > 0 and l[x - 1] == 'B' and (l[x] == 'G'):
			(t[x - 1], t[x]) = (t[x], t[x - 1])
print(reduce(lambda x, y: x + y, t))


(n, t) = map(int, input().split())
b = input()
a = []
for i in b:
	a.append(i)
for _ in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i + 1] = 'B'
			a[i] = 'G'
			i += 1
		i += 1
print(''.join(a))


(n, x) = map(int, input().split())
l = list(map(str, input().strip()))
i = x
while i > 0:
	temp = l[:]
	f = 1
	for j in range(0, n - 1, f):
		if l[j] == 'B' and l[j + 1] == 'G':
			temp[j] = 'G'
			temp[j + 1] = 'B'
			f = 2
		else:
			f = 1
	i -= 1
	l = temp[:]
print(*l, sep='')


(n, t) = map(int, input().split())
o = list(input())
for i in range(t):
	p = False
	for i in range(n - 1):
		if p:
			p = False
			continue
		if o[i] < o[i + 1]:
			(o[i], o[i + 1]) = (o[i + 1], o[i])
			p = True
print(''.join(o))


(n, t) = map(int, input().split(' '))
f = input()
lst = []
for i in range(len(f)):
	lst += f[i]
for j in range(t):
	k = 0
	if len(lst) >= 2:
		ajk = lst[-2]
		if ajk == 'B' and lst[-1] == 'G':
			lst[-2] == 'G'
			lst[-1] == 'B'
	while k < n - 1:
		if lst[k] == 'B' and lst[k + 1] == 'G':
			lst[k] = 'G'
			lst[k + 1] = 'B'
			k += 2
		else:
			k += 1
s = ''
for l in range(len(lst)):
	s += lst[l]
print(s)


(n, t) = list(map(int, input().split()))
w = list(map(str, input()))
for _ in range(t):
	i = 1
	while i < n:
		if w[i] == 'G' and w[i - 1] == 'B':
			w[i] = 'B'
			w[i - 1] = 'G'
			i += 2
		else:
			i += 1
x = ''
for i in w:
	x += i
print(x)


def main():
	(n, m) = map(int, input().split())
	a = list(input())
	while m:
		i = 0
		while i < n - 1:
			if a[i] == 'B' and a[i + 1] == 'G':
				temp = a[i]
				a[i] = a[i + 1]
				a[i + 1] = temp
				i += 2
			else:
				i += 1
		m -= 1
	print(''.join(a))
main()


(people_amount, time) = map(int, input().split())
string = list(input())
for i in range(time):
	j = 0
	while j < len(string) - 1:
		if string[j] == 'B' and string[j + 1] == 'G':
			string[j] = 'G'
			string[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(string))


t = input()
temp = t.split()
n = int(temp[0])
time = int(temp[1])
s = input()
queue = list(s)
temporaryQueue = queue.copy()
for j in range(time):
	for i in range(1, n):
		if queue[i] == 'G' and queue[i - 1] == 'B':
			(temporaryQueue[i - 1], temporaryQueue[i]) = (temporaryQueue[i], temporaryQueue[i - 1])
	queue = temporaryQueue.copy()
for i in queue:
	print(i, end='')


def QueueAtSchool(n, t, queue):
	p = 0
	resultantQueue = list(queue)
	while p < t:
		i = n - 1
		while i > 0:
			if resultantQueue[i] == 'G' and resultantQueue[i - 1] == 'B':
				temp = resultantQueue[i - 1]
				resultantQueue[i - 1] = resultantQueue[i]
				resultantQueue[i] = temp
				i -= 1
			i -= 1
		p += 1
	resultantString = ''
	for q in resultantQueue:
		resultantString += q
	return resultantString
(n, t) = [int(x) for x in input().split()]
queue = input()
print(QueueAtSchool(n, t, queue))


(n, t) = map(int, input().split())
st = input()
s = list(st)
while t != 0:
	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
		else:
			i += 1
	t -= 1
print(''.join(s))


line = input()
row = input()
nums = line.split(' ')
n = int(nums[0])
t = int(nums[1])
Count = 0

def swap(string, count):
	if count < t:
		count += 1
		new_string = ''
		for i in range(0, n):
			if string[i] == 'B':
				if i != n - 1:
					new_string += string[i + 1]
				else:
					new_string += 'B'
			elif i == 0:
				new_string += 'G'
			else:
				new_string += string[i - 1]
		return swap(new_string, count)
	else:
		return string
print(swap(row, Count))


(n, k) = map(int, input().split())
l = list(input())
lt = n - 1
j = 0
for i in range(k):
	j = 0
	while j < n - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			l[j] = 'G'
			l[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(l))


(t, x) = map(int, input().split())
a = list(input())
f = 10 ** 9
while x:
	for i in range(0, len(a) - 1):
		if f == 1:
			f = 0
			continue
		elif a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			f = 1
	f = 0
	x -= 1
print(''.join(a))


(n, m) = list(map(int, input().split()))
s = input()
for _ in range(m):
	a = s.replace('BG', 'GB')
	s = a
print(a)


def change(string, n):
	change = []
	for i in range(0, n):
		if i + 1 < n:
			if string[i] == 'B' and string[i + 1] == 'G':
				if i not in change:
					(string[i], string[i + 1]) = (string[i + 1], string[i])
					change.append(i + 1)
	return string
s = str(input())
l = s.split(' ')
n = int(l[0])
times = int(l[1])
input_string = str(input())
string = list(input_string)
for i in range(0, times):
	string = change(string, n)
result = ''
for items in string:
	result = result + items
print(result, end='')


def main():
	(n, k) = map(int, input().strip().split())
	queue = list(input().strip())
	while k != 0:
		k -= 1
		idx = 0
		while idx < n - 1:
			if queue[idx] == 'B' and queue[idx + 1] == 'G':
				(queue[idx], queue[idx + 1]) = ('G', 'B')
				idx += 1
			idx += 1
	print(''.join(queue))
main()


n = input()
(num, t) = n.split(' ')
que = input()
que = list(que)
check = 0
while check < int(t):
	count = 0
	while count < int(num) - 1:
		if que[count] == 'B' and que[count + 1] == 'G':
			que[count] = 'G'
			que[count + 1] = 'B'
			count += 2
		else:
			count += 1
	check += 1
print(''.join(que))


(n, t) = map(int, input().split())
cola = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if cola[j] == 'B' and cola[j + 1] == 'G':
			tmp = cola[j]
			cola[j] = cola[j + 1]
			cola[j + 1] = tmp
			j += 2
			continue
		j += 1
print(''.join(cola))


def solve(n, t, q):
	for j in range(t):
		i = 0
		while i < n - 1:
			if q[i] == 'B' and q[i + 1] == 'G':
				q[i] = 'G'
				q[i + 1] = 'B'
				i += 2
			else:
				i += 1
	return ''.join(q)

def main():
	(n, t) = list(map(int, input().split()))
	q = list(input())
	print(solve(n, t, q))
main()


import math

def main():
	(n, t) = map(int, input().split())
	g = input()
	s = [None] * len(g)
	for i in range(len(g)):
		s[i] = g[i]
	while t > 0:
		t -= 1
		i = 0
		while i < len(s) - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				h = s[i]
				(s[i], s[i + 1]) = (s[i + 1], h)
				i += 1
			i += 1
	for i in range(len(s)):
		print(s[i], end='')
main()


(n, t) = list(map(int, input().split(' ')))
s = input()
new_s = s
while t > 0:
	for i in range(int(n) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			new_s = list(new_s)
			new_s[i] = s[i + 1]
			new_s[i + 1] = s[i]
			new_s = ''.join(new_s)
	s = new_s
	t = t - 1
print(new_s)


(n, t) = map(int, input().split())
a = list(input())
c = 0
a.append(0)
while t != c:
	i = 1
	while len(a) != i:
		if a[i - 1] == 'B' and a[i] == 'G':
			a[i - 1] = 'G'
			a[i] = 'B'
			i += 1
		i += 1
	c += 1
a.remove(0)
print(''.join(a))


(n, t) = list(map(int, input().split()))
q = list(input())
for i in range(t):
	ts = []
	for j in range(n - 1):
		if q[j] == 'B' and q[j + 1] == 'G':
			ts.append(j)
	for x in ts:
		(q[x], q[x + 1]) = (q[x + 1], q[x])
print(''.join(q))


(n, t) = map(int, input().split())
s = [c for c in input()]
for _ in range(t):
	i = 0
	while i < n:
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(s))


(number, time) = input().split()
line = input()
time = int(time)
line = list(line)
line_end = line[:]
time_now = 0
while time_now < time:
	for i in range(0, len(line) - 1):
		if line[i] == 'B':
			if line[i + 1] == 'G':
				line_end[i] = 'G'
				line_end[i + 1] = 'B'
	line = line_end[:]
	time_now += 1
ans_line = ''.join(line_end)
print(ans_line)


(n, t) = [int(x) for x in input().split()]
x = input()
arr = [x1 for x1 in x]
for i in range(t):
	j = 0
	while j < n - 1:
		if arr[j] == 'B' and arr[j + 1] == 'G':
			arr[j + 1] = 'B'
			arr[j] = 'G'
			j += 2
		else:
			j += 1
str = ''.join(arr)
print(str)


(n, t) = map(int, input().split())
s = list(input())
j = 0
for i in range(t):
	while j <= n - 2:
		if s[j] == 'B' and s[j + 1] == 'G':
			s.insert(j, s.pop(j + 1))
			j += 2
		else:
			j += 1
	j = 0
listToStr = ''.join(map(str, s))
print(listToStr)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
a = list(input())
for z in range(t):
	for x in range(1, n):
		if a[x] == 'G' and a[x - 1] == 'B':
			a[x] = 'T'
			a[x - 1] = 'G'
	for x in range(n):
		if a[x] == 'T':
			a[x] = 'B'
print(''.join(a))


(a, b) = map(int, input().split())
c = str(input())
for d in range(b):
	c = c.replace('BG', 'GB')
print(c)


i = input().split(' ')
(n, t) = (int(i[0]), int(i[1]))
s = input()
ls = list(s)

def switch(x):
	k = 0
	while k < n - 1:
		if x[k] == 'B' and x[k + 1] == 'G':
			x[k] = 'G'
			x[k + 1] = 'B'
			k += 2
		else:
			k += 1
	return x
for j in range(t):
	ls = switch(ls)
s = ''.join(ls)
print(s)


(a, b) = [int(x) for x in input().split()]
s = list(input())
flag = 0
for i in range(b):
	flag = 0
	for j in range(a - 1):
		if flag == 1:
			flag = 0
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j = j + 1
			flag = 1
print(''.join(s))


(n, x) = map(int, input().split())
s = list(input())
for j in range(x):
	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
		else:
			i += 1
S = ''
for i in s:
	S += i
print(S)


(n, t) = map(int, input().split())
a = list(input())
for _ in range(t):
	pos = 0
	while pos < n - 1:
		if a[pos] == 'B' and a[pos + 1] == 'G':
			a[pos] = 'G'
			a[pos + 1] = 'B'
			pos += 2
		else:
			pos += 1
print(''.join(a))


(a, b) = map(int, input().split())
n = input()
for i in range(b):
	if 'BG' in n:
		x = n.count('BG')
		n = n.replace('BG', 'GB')
print(n)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
(n, t) = rinput()
A = list(input())
for _ in range(t):
	i = 0
	while i < n - 1:
		if A[i] == 'B' and A[i + 1] == 'G':
			(A[i], A[i + 1]) = (A[i + 1], A[i])
			i += 1
		i += 1
print(''.join(A))


(x, y) = map(int, input().split())
s = input()
s = [x for x in s]
length = len(s)
for i in range(y):
	l = [i for (i, j) in enumerate(s) if j == 'B']
	for i in l:
		if i + 1 != length and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
print(''.join(s))


w = int(input().split()[1])
x = input()
y = []
for i in x:
	y.append(i)
z = y.count('B')
m = [i for (i, x) in enumerate(y) if x == 'B']
result = ''
try:
	for r in range(0, w):
		for i in range(0, z):
			if int(m[i]) + 1 < len(y) and y[int(m[i]) + 1] == 'G':
				y[int(m[i]) + 1] = 'B'
				y[int(m[i])] = 'G'
				m[i] = int(m[i]) + 1
	for o in y:
		result += str(o)
	print(result)
except:
	p = 0


(a, b) = [int(x) for x in input().split()]
line = input()
for i in range(b):
	line = line.replace('BG', 'GB')
print(line)


str1 = input().split()
n = int(str1[0])
t = int(str1[1])
str2 = input()
arrangement = list()
for i in range(0, len(str2), 1):
	arrangement.append(str2[i])
change = list()
for i in range(0, t, 1):
	del change[0:]
	for j in range(0, n - 1, 1):
		if arrangement[j] == 'B' and arrangement[j + 1] == 'G':
			change.append(j)
	for k in change:
		(arrangement[k], arrangement[k + 1]) = ('G', 'B')
sep = ''
print(sep.join(arrangement))


amtTime = input().split(' ')
time = int(amtTime[1])
queue = input()
ctr = 0
while ctr < time:
	j = 0
	while j < len(queue) - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			queue = queue[0:j] + 'G' + 'B' + queue[j + 2:]
			j += 1
		j += 1
	ctr += 1
print(queue)


(n, k) = map(int, input().split())
arr = list(input())
for i in range(k):
	x = 0
	while x < n - 1:
		if arr[x] == 'B' and arr[x + 1] == 'G':
			temp = arr[x]
			arr[x] = arr[x + 1]
			arr[x + 1] = temp
			x += 1
		x += 1
print(''.join(arr))


(n, t) = [int(i) for i in input().split()]
q = [i for i in input()]
for j in range(t):
	fl = False
	for i in range(len(q) - 1):
		if fl:
			fl = False
			continue
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			fl = True
for i in range(len(q)):
	print(q[i], end='')


zoom = input().split()
news = int(zoom[1])
andthen = str(input())
for i in range(news):
	andthen = andthen.replace('BG', 'GB')
print(andthen)


(n, t) = map(int, input().split())
ss = input()
words = []
for i in range(0, n):
	words.append(ss[i])
step = False
for i in range(0, t):
	step = False
	for j in range(0, n - 1):
		if step == True:
			step = False
			continue
		if words[j] == 'B' and words[j + 1] == 'G':
			words[j] = 'G'
			words[j + 1] = 'B'
			step = True
s = ''
print(s.join(words))


(n, n1) = map(int, input().split())
queue = list(input())
while n1 > 0:
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue[i] = 'G'
			queue[i + 1] = 'B'
			i += 1
		i += 1
	n1 -= 1
print(''.join(queue))


(n, t) = map(int, input().split(' '))
s = list(input())
for i in range(t):
	b = []
	for j in range(len(s)):
		if s[j] == 'B':
			b.append(j)
	for k in range(len(b)):
		if b[k] + 1 == len(s):
			break
		if s[b[k] + 1] == 'G':
			(s[b[k]], s[b[k] + 1]) = (s[b[k] + 1], s[b[k]])
l = ''
for i in s:
	l = l + i
print(l)


(n, t) = map(int, input().split())
queue = list(str(input()))
for i in range(t):
	j = 0
	while j < n - 1:
		if queue[j] == 'B':
			if queue[j + 1] == 'G':
				queue[j] = 'G'
				queue[j + 1] = 'B'
				j += 1
		j += 1
print(''.join(queue))


(n, t) = input().split()
n = int(n)
t = int(t)
s = list(input())
for i in range(t):
	Bp = []
	for j in range(len(s)):
		if j != len(s) - 1:
			if s[j] == 'B' and s[j + 1] == 'G':
				Bp.append(j)
	for i in Bp:
		temp = s[i]
		s[i] = s[i + 1]
		s[i + 1] = temp
print(''.join(map(str, s)))


n = list(map(int, input().split()))
q = input()
q = [x for x in q]
for i in range(n[1]):
	j = 0
	while j < len(q) - 1:
		if q[j] == 'B' and q[j + 1] == 'G':
			temp = q[j]
			q[j] = q[j + 1]
			q[j + 1] = temp
			j += 2
		else:
			j += 1
print(''.join(q))


(n, t) = [int(m) for m in input().split()]
lin = input()
line = []
line2 = []
for w in lin:
	line.append(w)
	line2.append(w)
for j in range(t):
	for k in range(n - 1):
		if line2[k] == 'B':
			temp = line[k]
			line[k] = line[k + 1]
			line[k + 1] = temp
	for i in range(n):
		line2[i] = line[i]
for i in range(n):
	print(line[i], end='')


(a, b) = map(int, input().split())
s = input()
s = list(s)
for i in range(b):
	j = 0
	while j < a - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j = j + 1
		j = j + 1
print(''.join(s))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
s = input()
l = []
for x in s:
	l.append(x)
for _ in range(t):
	just_changed = False
	for k in range(len(l)):
		if k + 1 < len(l):
			if l[k] == 'B' and l[k + 1] == 'G' and (not just_changed):
				temp = l[k]
				l[k] = l[k + 1]
				l[k + 1] = temp
				just_changed = True
			else:
				just_changed = False
answer = ''
answer = answer.join(l)
print(answer)


(n, t) = [int(x) for x in input().split()]
s = input()
q = s
s = []
for i in q:
	s.append(i)
for z 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
		else:
			i += 1
ans = ''
for i in s:
	ans += i
print(ans)


import sys
import math
from collections import Counter
from collections import OrderedDict
from collections import defaultdict
from functools import reduce
sys.setrecursionlimit(10 ** 6)

def inputt():
	return sys.stdin.readline().strip()

def printt(n):
	sys.stdout.write(str(n) + '\n')

def listt():
	return [int(i) for i in inputt().split()]

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // gcd(a, b)

def factors(n):
	step = 2 if n % 2 else 1
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(math.sqrt(n)) + 1, step) if n % i == 0)))

def comb(n, k):
	factn = math.factorial(n)
	factk = math.factorial(k)
	fact = math.factorial(n - k)
	ans = factn // (factk * fact)
	return ans

def is_prime(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n > 2 and n % 2 == 0:
		return False
	max_div = math.floor(math.sqrt(n))
	for i in range(3, 1 + max_div, 2):
		if n % i == 0:
			return False
	return True

def maxpower(n, x):
	B_max = int(math.log(n, x)) + 1
	return B_max
t = 1
for _ in range(t):
	(n, ti) = map(int, inputt().split())
	s = inputt()
	if s.count('G') == 0:
		printt(s)
	else:
		g = list(s)
		for i in range(ti):
			s = ''.join(g)
			for j in range(n - 1):
				if s[j] == 'B' and s[j + 1] == 'G':
					g[j] = 'G'
					g[j + 1] = 'B'
		print(''.join(g))


import re
(n, k) = map(int, input().split())
a = input()
for i in range(k):
	a = re.sub('BG', 'GB', a)
print(a)


(n, t) = list(map(int, input().split()))
queue = input()
for _ in range(t):
	sep_q = queue.split('BG')
	queue = 'GB'.join(sep_q)
print(queue)


def cin():
	return map(int, input().split())
import collections
(n, t) = cin()
s = input()
c = [ch for ch in s]
for ti in range(t):
	i = 0
	while i < n - 1:
		if c[i] == 'B' and c[i + 1] == 'G':
			(c[i], c[i + 1]) = (c[i + 1], c[i])
			i += 1
		i += 1
print(''.join(c))


nk = list(map(int, input().split()))
s = list(input())

def swap():
	i = 0
	while i < len(s):
		if i != len(s) - 1 and (s[i], s[i + 1]) == ('B', 'G'):
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
for i in range(nk[1]):
	swap()
print(''.join(s))


(n, t) = list(map(int, input().split()))
s = str(input())
l = [str(i) for i in s]
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(x, y) = [int(x) for x in input('').split()]
z = str(input(''))
s = 'BG'
for i in range(0, y):
	z = z.replace('BG', 'GB')
print(z)


(n, ik) = map(lambda x: int(x), input().split())
nk = str(input())
for i in range(ik):
	if 'BG' in nk:
		nk = nk.replace('BG', 'GB')
print(nk)


def main():
	inf = input().split(' ')
	n = int(inf[0])
	time = int(inf[1])
	turn = input()
	for i in range(time):
		try:
			turn = turn.replace('BG', 'GB')
		except:
			pass
	print(turn)
main()


n = list(map(int, input().split()))
teks = input()
txt = list(teks)
tmp = ''
cek = -1
for i in range(n[1]):
	cek = -1
	for j in range(n[0]):
		if j + 1 >= n[0]:
			break
		if txt[j] == 'B' and txt[j + 1] == 'G' and (cek == -1):
			tmp = txt[j]
			txt[j] = txt[j + 1]
			txt[j + 1] = tmp
			cek = 0
		elif cek == 0:
			cek = -1
			continue
for i in range(n[0]):
	print(txt[i], end='')


entry = input()
entry = [int(i) for i in entry.split()]
queue = input()
queue = list(queue)
swap = False
for i in range(entry[1]):
	for e in range(entry[0]):
		if e + 1 < len(queue) and swap == False:
			if queue[e] == 'B' and queue[e + 1] == 'G':
				queue[e] = 'G'
				queue[e + 1] = 'B'
				swap = True
		else:
			swap = False
print(''.join(queue))


n = input().split()
(n, t) = (int(n[0]), int(n[1]))
ip = input()
while t > 0:
	temp = ''
	i = 0
	while i < n - 1:
		if ip[i] == 'B' and ip[i + 1] == 'G':
			temp += 'GB'
			i += 2
		else:
			temp += ip[i]
			i += 1
	if i == n - 1:
		temp += ip[i]
	ip = temp
	t -= 1
print(ip)


(n, t) = map(int, input().split())
s = list(input())
q = []
q[:] = s[:]
for j in range(t):
	s[:] = q[:]
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
print(''.join(q))


(a, b) = map(int, input().split())
s = str(input())
for i in range(b):
	s = s.replace('BG', 'GB')
print(s)


def queue(n, t, string):
	res = list(map(str, string))
	for i in range(t):
		cur = ''
		prev = ''
		for c in range(n):
			cur = res[c]
			if prev == 'B' and cur == 'G':
				(res[c], res[c - 1]) = (res[c - 1], res[c])
			prev = cur
	return ''.join(res)
(n, t) = map(int, input().split())
string = str(input())
print(queue(n, t, string))


import sys
try:
	sys.stdin = open('inputs.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
finally:
	input = sys.stdin.readline
	print = sys.stdout.write
(n, t) = map(int, input().split())
q = list(input().strip())
for _ in range(t):
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			i += 1
		i += 1
print(''.join(q))


firstLine = input().split()
population = int(firstLine[0])
time = int(firstLine[1])
lineUp = input()
for n in range(time):
	i = 0
	while i < population - 1:
		if lineUp[i] == 'B' and lineUp[i + 1] == 'G':
			lineUp = lineUp[:i] + 'GB' + lineUp[i + 2:]
			i += 2
		else:
			i += 1
print(lineUp)


def main(n, t, s):
	for i in range(t):
		j = 0
		while j < n - 1:
			if s[j] == 'B' and s[j + 1] == 'G':
				(s[j], s[j + 1]) = (s[j + 1], s[j])
				j += 1
			j += 1
	return ''.join(s)
(n, t) = [int(x) for x in input().split()]
s = [x for x in input()]
print(main(n, t, s))


(n, t) = map(int, input().split())
Q = input()
t = min(t, n - 1)
for i in range(t):
	Q_new = ''
	k = Q.split('G')
	for j in k[:-1]:
		if j:
			Q_new += j[:-1] + 'G' + 'B'
		else:
			Q_new += 'G'
	Q_new += k[-1]
	Q = Q_new[:]
print(Q)


def move(slist):
	i = 0
	while i in range(len(slist)):
		if slist[i:i + 2] == ['B', 'G']:
			slist[i] = 'G'
			slist[i + 1] = 'B'
			i += 2
		else:
			i += 1
	return slist
(length, times) = list(map(int, input().split()))
slist = list(input())
for n in range(times):
	move(slist)
print(''.join(slist))


(n, t) = [int(x) for x in input().split()]
s = input()
for _ in range(t):
	s = s.replace('BG', 'GB')
print(s)


(tam, time) = [int(i) for i in input().split()]
pala = input()
for i in range(time):
	pala = pala.replace('BG', 'GB')
print(pala)


(n, t) = tuple(map(int, input().split()))
s = input()
B = 'B'
G = 'G'

def is_need():
	need = False
	for j in range(n - 1):
		if s[j] == B and s[j + 1] == G:
			need = True
			break
	return need
if is_need():

	def swap(s, j):
		if s[j] == B and s[j + 1] == G:
			return (s[:j] + G + B + s[j + 2:], j + 2)
		return (s, j + 1)
	for i in range(t):
		j = 0
		while j < n - 1:
			(s, j) = swap(s, j)
		if not is_need():
			break
print(s)


(n, t) = map(int, input().split(' '))
s = list(input().strip())
for _ in range(t):
	i = 1
	while i < n:
		if s[i] == 'G' and s[i - 1] == 'B':
			s[i] = 'B'
			s[i - 1] = 'G'
			i += 1
		i += 1
print(''.join(s))


(repeat, line) = (int(input().split()[1]), input())
for i in range(repeat):
	line = line.replace('BG', 'GB')
print(line)


(n, t) = map(int, input().split())
s = input()
v = [i for i in s]
t1 = 0
while t1 < t:
	i = 0
	while i < n - 1:
		if v[i] == 'B' and v[i + 1] == 'G':
			(v[i], v[i + 1]) = ('G', 'B')
			i = i + 1
		i = i + 1
	t1 += 1
print(''.join(v))


while True:
	try:

		def print_res(a):
			b = a[0]
			for i in range(1, n):
				b += a[i]
			print(b)

		def solve(a, n, t):
			(i, j) = (0, 0)
			while j < t:
				while i < n:
					if i + 1 < n and a[i] == 'B' and (a[i + 1] == 'G'):
						(a[i], a[i + 1]) = (a[i + 1], a[i])
						i += 1
					i += 1
				i = 0
				j += 1
			print_res(a)
		if __name__ == '__main__':
			(n, t) = map(int, input().split())
			a = list(input())
			solve(a, n, t)
	except EOFError:
		break


nt = input().strip().split()
n = int(nt[0])
t = int(nt[1])
line = list(input().strip())
while t > 0:
	i = 0
	while i < n - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			line[i] = 'G'
			line[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	t = t - 1
print(''.join(line))


(n, a) = map(int, input().split())
b = list(input())

def second(a):
	b = len(a)
	i = 0
	while b - 1 > i:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	return a
while a != 0:
	b = second(b)
	a = a - 1
print(''.join(b))


(n, t) = input().split()
(n, t) = (int(n), int(t))
l = []
l = list(input())
while t:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 1
		i += 1
	t -= 1
print(''.join(l))


(n, t) = map(int, input().split())
s = list(input())
for _ in range(t):
	di = -1
	for (i, x) in enumerate(s):
		if i and di < i - 1:
			if s[i - 1] == 'B' and x == 'G':
				s[i - 1] = 'G'
				s[i] = 'B'
				di = i
print(''.join(s))


(n, m) = map(int, input().split())
s = input()
s = list(s)
l = []
for i in range(m):
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			l.append([j, j + 1])
	for d in range(len(l)):
		(s[l[d][0]], s[l[d][1]]) = (s[l[d][1]], s[l[d][0]])
	l = []
print(''.join(s))


f_s = input()
students = input()
(students_count, seconds) = [int(i) for i in f_s.strip().split()]
for sec in range(seconds):
	new_order = ''
	pss = False
	for (n, stud) in enumerate(students):
		if pss:
			pss = False
			continue
		if n + 1 <= len(students) - 1 and stud == 'B' and (students[n + 1] == 'G'):
			new_order += 'G' + 'B'
			pss = True
		else:
			new_order += stud
	students = new_order
print(students)


t = int(input()[2:])
s = input()
while t:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


(c, t) = map(int, input().split())
s = input()
newR = ''
for i in range(t):
	sl = 0
	newR = ''
	if sl >= c - 1:
		newR = s
		break
	while sl < c - 1:
		if s[sl] == 'B' and s[sl + 1] == 'G':
			newR += 'GB'
			sl += 2
		else:
			newR += s[sl]
			sl += 1
		if sl == c - 1:
			newR = newR + s[-1]
	s = newR
print(newR)


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
(n, t) = rinput()
s = input()
l = len(s)
for i in range(t):
	ans = ''
	j = 0
	while j < l:
		if s[j] == 'B' and j < l - 1 and (s[j + 1] == 'G'):
			ans += 'GB'
			j += 1
		else:
			ans += s[j]
		j += 1
	s = ans
print(ans)


(l, r) = [int(i) for i in input().split()]
pos = input()
for i in range(r):
	pos = pos.replace('BG', 'GB')
print(pos)


(num, time) = map(int, input().split())
string = input()
list_a = list(string)
while time > 0:
	i = 0
	while i < len(list_a) - 1:
		if list_a[i] == 'B' and list_a[i + 1] == 'G':
			(list_a[i], list_a[i + 1]) = (list_a[i + 1], list_a[i])
			i += 1
		i += 1
	time -= 1
string = ''.join([str(elem) for elem in list_a])
print(string)


(n, t) = input().split()
n = int(n)
t = int(t)
inputLetters = str(input())
arrayQueue = []
for j in range(n):
	arrayQueue.append(inputLetters[j])
while t != 0:
	i = 0
	while i < len(arrayQueue):
		if i != len(arrayQueue) - 1 and (arrayQueue[i] == 'B' and arrayQueue[i + 1] == 'G'):
			arrayQueue[i] = 'G'
			arrayQueue[i + 1] = 'B'
			i += 2
		else:
			i += 1
	t -= 1
for j in range(n):
	if j + 1 == n:
		print(arrayQueue[-1])
	else:
		print(arrayQueue[j], end='')


(n, t) = [int(x) for x in input().split()]
arr = [x for x in input()]
for i in range(t):
	j = 0
	while j < n - 1:
		if arr[j] == 'B' and arr[j + 1] == 'G':
			arr[j] = 'G'
			arr[j + 1] = 'B'
			j += 1
		j += 1
for k in arr:
	print(k, end='')


mas = input().split()
t = int(mas[1])
str = input()
for i in range(t):
	str = str.replace('BG', 'GB')
print(str)


(m, n) = [int(i) for i in input().split()]
k = input()
l = []
for i in k:
	l.append(i)
o = l.copy()
for i in range(n):
	for i in range(m - 1):
		if o[-(i + 1)] == 'G' and o[-(i + 2)] == 'B':
			l.insert(m - i, 'B')
			l.pop(-(i + 3))
	o = l.copy()
print(''.join(l))


(n, t) = map(int, input().split())
ar = [*input()]
for i in range(t):
	flag = False
	flag1 = True
	for j in range(1, n):
		if flag:
			flag = False
			continue
		if ar[j] == 'G' and ar[j - 1] == 'B':
			ar[j] = 'B'
			ar[j - 1] = 'G'
			flag = True
			flag1 = False
	if flag1:
		break
print(''.join(map(str, ar)))


(a, b) = map(int, input().strip().split())
(str1, count) = (input().strip(), 5000)
while b:
	str1 = str1.replace('BG', 'GB')
	b -= 1
print(str1)


(n, t) = map(int, input().split(' '))
l = list(input())
for i in range(t):
	f = [0] * n
	for j in range(n - 1):
		if l[j] == 'B' and l[j + 1] == 'G' and (f[j] != 1):
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			f[j] = f[j + 1] = 1
for i in l:
	print(i, end='')


(n, t) = map(int, input().split())
s = input()
l = []
for i in range(n):
	if s[i] == 'G':
		l.append(1)
	else:
		l.append(0)
while t:
	t -= 1
	i = 0
	while i < n - 1:
		if l[i] < l[i + 1]:
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 2
		else:
			i += 1
for i in range(n):
	if l[i] == 1:
		print('G', end='')
	else:
		print('B', end='')


L = input()
L = L.split()
for r in range(2):
	L[r] = int(L[r])
P = str(input())
P = ' '.join(P)
P = P.split()
for k in range(L[1]):
	entra = 1
	for h in range(L[0] - 1):
		if P[h] == 'B' and P[h + 1] == 'G' and (entra == 1):
			TEM = P[h + 1]
			P[h + 1] = P[h]
			P[h] = TEM
			entra = 0
		else:
			entra = 1
p = ''.join(P)
print(p)


(n, t) = map(int, input().split())
s = input()
for second in range(t):
	it = 0
	while it < len(s) - 1:
		if s[it] == 'B' and s[it + 1] == 'G':
			s = s[:it] + 'G' + 'B' + s[it + 2:]
			it += 2
		else:
			it += 1
print(s)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = list(input())
for k_qtr in range(k):
	i = 1
	while i < n:
		b = 0
		if s[i - 1] == 'B' and s[i] == 'G':
			(s[i - 1], s[i]) = ('G', 'B')
			b = b + 1
		if b == 1:
			i = i + 1
		i = i + 1
print(''.join(map(str, s)))


(s, t) = [int(i) for i in input().split()]
sT = input()
l = []
for i in sT:
	l.append(i)
for j in range(t):
	k = 0
	while k < s - 1:
		if l[k] == 'B' and l[k + 1] == 'G':
			l[k] = 'G'
			l[k + 1] = 'B'
			k += 1
		k += 1
for i in l:
	print(i, end='')


(n, t) = map(int, input().strip().split(' '))
arr = [i for i in input().strip()]
for a0 in range(t):
	i = 0
	while i < n - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
			i += 2
		else:
			i += 1
print(''.join(arr))


enter = input()
string = input()
enter = enter.split(' ')
number_characters = int(enter[0])
time = int(enter[1])
stringList = list(string)
first_initial_point = 0
while first_initial_point < time:
	second_initial_point = 0
	while second_initial_point < number_characters - 1:
		if stringList[second_initial_point] == 'B':
			if stringList[second_initial_point + 1] == 'G':
				stringList[second_initial_point] = 'G'
				stringList[second_initial_point + 1] = 'B'
				second_initial_point += 1
		second_initial_point += 1
	first_initial_point += 1
string = ''.join(stringList)
print(string)


x = list(map(int, input().split()))
t = x[1]
q = list(input())
for i in range(t):
	s = 1
	while s < len(q):
		if q[s] == 'G' and q[s - 1] == 'B':
			q[s] = 'B'
			q[s - 1] = 'G'
			s = s + 1
		s = s + 1
print(''.join(q))


(n, t) = [int(x) for x in input().split()]
queue = str(input())
queuelist = list(queue)
for j in range(t):
	for i in range(n - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queuelist[i] = 'G'
			queuelist[i + 1] = 'B'
	queue = ''.join(queuelist)
print(queue)


a = list(map(int, input().split()))
b = input()
c = []
for i in range(len(b)):
	c.append(b[i])
b = c
for i in range(a[1]):
	t = 0
	for j in range(len(b) - 1):
		if t == 0:
			if b[j] == 'B' and b[j + 1] == 'G':
				b[j + 1] = 'B'
				b[j] = 'G'
				t = 1
		else:
			t = 0
a = ''
for i in range(len(b)):
	a += b[i]
print(a)


(n, t) = list(map(int, input().split()))
queue = list(input())
count = 0
while count < t:
	boys = [index for (index, que) in enumerate(queue) if que == 'B']
	for i in boys:
		if i != len(queue) - 1 and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = ('G', 'B')
	count += 1
print(''.join(queue))


n = input()
a = int(n.split()[1])
q = input()
for x in range(1, a + 1):
	lst = []
	i = 0
	while i < len(q):
		if i < len(q) - 1 and q[i] == 'B' and (q[i + 1] == 'G'):
			lst.append(q[i + 1])
			lst.append(q[i])
			i += 2
		else:
			lst.append(q[i])
			i += 1
	q = ''.join(lst)
print(q)


(n, m) = map(int, input().split())
a = str(input())
a = list(a)
i = 0
c = []
for j in range(m):
	i = 0
	c = []
	while i < len(a) - 1:
		if not a[i] == a[i + 1]:
			if a[i] == 'B' and a[i + 1] == 'G':
				c.append(i)
				i = i + 2
			else:
				i = i + 1
			if i > len(a) - 1:
				break
		else:
			i = i + 1
	for i in c:
		(a[i], a[i + 1]) = (a[i + 1], a[i])
a = ''.join(a)
print(a)


(n, t) = input().split()
queue = str(input())
n = int(n)
t = int(t)
i = 0
while i < t:
	queue = queue.replace('BG', 'GB')
	i += 1
print(queue)


(n, t) = map(int, input().split())
s = list(input())
for _ in range(t):
	k = n
	for i in range(n - 1):
		if i == k:
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = ('G', 'B')
			k = i + 1
print(''.join(s))


(n, t) = map(int, input().split())
S = list(input())
ret = list(S)
for x in range(t):
	nexts = [ret[0]]
	for y in range(1, n):
		nexts.append(ret[y])
		if ret[y - 1] == 'B' and ret[y] == 'G':
			(nexts[y - 1], nexts[y]) = ('G', 'B')
	ret = nexts
RET = ''
for x in ret:
	RET += x
print(RET)


(a, b) = map(int, input().split())
c = input()
c = list(c)
while b != 0:
	i = 0
	while i < a - 1:
		if c[i] == 'B':
			(c[i], c[i + 1]) = (c[i + 1], c[i])
			if c[i] != c[i + 1]:
				i += 1
		i += 1
	b -= 1
print(*c, sep='')


(a, b) = map(int, input().split())
s = str(input())
i = j = c = 0
n = [0] * a
while i < a:
	if s[i] == 'G':
		n[i] = 1
	i += 1
i = 0
while j < b:
	while i < a - 1:
		if n[i] == 0 and n[i + 1] == 1:
			c = n[i]
			n[i] = n[i + 1]
			n[i + 1] = c
			i += 1
		i += 1
	j += 1
	i = 0
x = str()
while i < a:
	if n[i] == 1:
		x = x + 'G'
	else:
		x = x + 'B'
	i += 1
print(x)


(x, y) = [int(a) for a in input().split()]
n = input()
ar = []
s = ''
for i in n:
	ar.append(i)
for j in range(0, y):
	h = 0
	while h < x - 1:
		if ar[h] == 'B' and ar[h + 1] == 'G':
			c = ar[h]
			ar[h] = ar[h + 1]
			ar[h + 1] = c
			h = h + 2
		else:
			h = h + 1
g = s.join(ar)
print(g)


import re

class CustomException(Exception):

	def __init__(self, *args, **kwargs):
		super().__init__(*args, **kwargs)
		self.message = args[0]

def mCheckInputs(identifier, *args, search=re.compile('[^BG]').search):
	if identifier == 'is-Int-In-Range':
		x = args.__sizeof__()
		if len(args[0]) == 2 and 1 <= args[0][0] <= 50 and (1 <= args[0][1] <= 50):
			return (args[0][0], args[0][1])
		else:
			exit(1)
	elif identifier == 'Is-String-And-Of-Length':
		if not bool(search(args[0])) and len(args[0]) == args[1]:
			return args[0]
		else:
			exit(1)
	else:
		exit(1)

def mHandleInputs():
	try:
		fitstInputLine = list(map(int, input().split()))
		secondInputLine = input()
		(n, t) = mCheckInputs('is-Int-In-Range', fitstInputLine)
		position = mCheckInputs('Is-String-And-Of-Length', secondInputLine, n)
		return (n, t, position)
	except ValueError as e:
		exit(1)

def mDoWork(n, t, position):
	if 0 <= len(position) <= 1:
		return position
	positionList = list(position)
	for loopCounter in range(t):
		index = 0
		while index < position.__len__() - 1:
			if positionList[index] == 'B' and positionList[index + 1] == 'G':
				temp = positionList[index]
				positionList[index] = positionList[index + 1]
				positionList[index + 1] = temp
				index += 1
			index += 1
	newPosition = ''.join(positionList)
	return newPosition

def mFormatResult(result):
	print(result)

def main():
	(n, t, position) = mHandleInputs()
	result = mDoWork(n, t, position)
	mFormatResult(result)
main()


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
for i in range(k):
	s = s.replace('BG', 'GB')
print(s)


a = [int(i) for i in input().split()]
st = input()
for n in range(a[1]):
	i = 0
	while i < a[0] - 1:
		if st[i] == 'B' and st[i + 1] == 'G':
			st = st[:i] + st[i + 1] + st[i] + st[i + 2:]
			i += 2
		else:
			i += 1
print(st)


(a, b) = map(int, input().split())
l = input()
while b > 0:
	i = 0
	while i < a - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l = l[:i] + 'G' + 'B' + l[i + 2:]
			i = i + 2
		else:
			i = i + 1
	b = b - 1
print(l)


(a, b) = map(int, input().split())
d = input()
n = d
for x in range(b):
	n = n.replace('BG', 'GB')
print(n)


def main():
	from re import sub
	[n, t] = [int(_) for _ in input().split()]
	queue = input()
	for _ in range(t):
		queue = sub('BG', 'GB', queue)
	print(queue)
main()


(n, k) = map(int, input().split())
l = list(map(str, input()))
l.append('e')
i = 0
while k > 0:
	while i < n:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	i = 0
	k = k - 1
s = ''
for i in l:
	s = s + i
print(s[:n])


(n, t) = map(int, input().split())
s = input().upper()
s = s + 'f'
a = s.count('B')
x = s.count('G')
i = 0
m = min(a, x)
k = ''
for i in range(t):
	k = ''
	while len(s) > 1:
		if s[0] == 'B' and s[1] == 'G':
			b = ''
			b = b + s[1] + s[0]
			s = s[2:]
		else:
			b = ''
			b = b + s[0]
			s = s[1:]
		k = k + b
	s = k + 'f'
print(k)


(a, b) = map(int, input().strip().split())
string = list(input())
for i in range(b):
	vis = [True for i in range(90)]
	for j in range(len(string) - 1):
		if string[j] == 'B' and string[j + 1] == 'G' and vis[j]:
			(string[j], string[j + 1]) = ('G', 'B')
			vis[j + 1] = False
print(''.join(string))


import string
a = input()
s = input()
k1 = a.find(' ')
n = a[:k1]
t = a[k1 + 1:]
for i in range(int(t)):
	j = int(0)
	while j < len(s):
		if s[j] == 'G' and s[j - 1] == 'B' and (j > 0):
			s = s[:j - 1] + 'GB' + s[j + 1:]
			j += 1
		j += 1
print(s)


(n, m) = input().split()
a = list()
n = int(n)
m = int(m)
for i in input():
	a.append(i)
while m != 0:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a.pop(i)
			a.insert(i + 1, 'B')
			i += 1
		i += 1
	m -= 1
for i in a:
	print(i, end='')


(n, t) = map(int, input().split())
input_string = input()
list_string = list(input_string)
working_string = list(input_string)
for _ in range(t):
	for i in range(1, n):
		if list_string[i] == 'G' and list_string[i - 1] == 'B':
			working_string[i] = 'B'
			working_string[i - 1] = 'G'
	list_string = working_string.copy()
result = ''.join(working_string)
print(result)


(n, t) = [int(x) for x in input().split()]
arr = list(map(str, input()))
prev = None
for i in range(t):
	j = 1
	while j < n:
		if arr[j - 1] == 'B' and arr[j] == 'G':
			(arr[j - 1], arr[j]) = (arr[j], arr[j - 1])
			j += 1
		j += 1
print(''.join(arr))


(n, t) = [int(x) for x in input('').split()]
string = list(input(''))
for i in range(t):
	a = True
	for x in range(len(string) - 1):
		if string[x] == 'B' and string[x + 1] == 'G' and a:
			string[x] = 'G'
			string[x + 1] = 'B'
			a = False
		else:
			a = True
print(''.join(string))


L = input().split(' ')
n = int(L[0])
t = int(L[1])
q = input()

def move(q):
	l = len(q)
	L = list(q)
	i = 0
	while i < l - 1:
		if L[i] == 'B' and L[i + 1] == 'G':
			L[i] = 'G'
			L[i + 1] = 'B'
			i += 2
		else:
			i += 1
	new = ''
	for char in L:
		new += char
	return new
for _ in range(t):
	q = move(q)
print(q)


(N, T) = map(int, input().split(' '))
queue = input()
for t in range(T):
	i = 0
	while i < N - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue = queue[:i] + 'GB' + queue[i + 2:]
			i += 1
		i += 1
print(queue)


(n, t) = map(int, input().split())
s = input()
j = 0
l = []
for i in s:
	l.append(i)
if n == 1:
	print(s)
else:
	for i in range(t):
		j = 0
		while j < n - 1:
			if l[j] == 'B':
				if l[j + 1] == 'G':
					l[j] = 'G'
					l[j + 1] = 'B'
					j = j + 1
			j = j + 1
	print(''.join(l))


(n, t) = list(map(int, input().split()))
s = input()
check_list = []
check_list.extend(s)
for time in range(t):
	f = 0
	for i in range(1, len(check_list)):
		if check_list[i - 1] == 'B' and check_list[i] == 'G' and (not f):
			(check_list[i - 1], check_list[i]) = (check_list[i], check_list[i - 1])
			f = 2
		if f:
			f -= 1
s = ''
for i in check_list:
	s += i
print(s)


raw = str(input())
queue = str(input())
ind = raw.find(' ')
n = int(raw[:ind])
t = int(raw[ind + 1:])
Q = []
for char in queue:
	Q.append(char)
count = 0
while count < t:
	i = 0
	while i < n - 1:
		if Q[i] == 'B' and Q[i + 1] == 'G':
			Q[i] = 'G'
			Q[i + 1] = 'B'
			i += 1
		i += 1
	count += 1
print(''.join(Q))


(n, k) = map(int, input().split())
s = input()

def move(s):
	s = s.replace('BG', 'GB')
	return s
res = s
for i in range(k):
	res = move(res)
print(res)


(len, t) = list(map(int, input().split()))
s = list(input())
l = []
for i in range(t):
	for i in range(len - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			l.append(i)
	for i in l:
		(s[i], s[i + 1]) = (s[i + 1], s[i])
	l = []
print(''.join(s))


from sys import stdin
(n, t) = [int(i) for i in stdin.readline().split(' ')]
a = stdin.readline().strip()
for _ in range(t):
	s = list(a)
	res = [i for i in range(n) if a.startswith('BG', i)]
	for (i, val) in enumerate(res):
		(s[val], s[val + 1]) = (s[val + 1], s[val])
	a = ''.join(s)
print(a)


(num_children, time) = [int(a) for a in input().split()]
s = input()
for x in range(time):
	s = s.replace('BG', 'GB')
print(s)


arr1 = str(input())
arr = arr1.split()
n = int(arr[0])
t = int(arr[1])
strs = input()
final = ''
time = t
prev = []
for idfdf in range(t):
	for kk in range(n):
		i = strs[kk]
		if i == 'G':
			final += 'G'
			if len(prev) != 0:
				final += 'B'
				prev = []
			continue
		elif i == 'B' and len(prev) == 0:
			prev.append('B')
			continue
		else:
			final += 'B'
	vh = len(prev)
	final = final + 'B' * vh
	prev = []
	if strs == final:
		break
	strs = final
	final = ''
print(strs)


(n, t) = [int(x) for x in input().split()]
string = [x for x in input()]
for i in range(0, t):
	index = 0
	while index < n - 1:
		char = string[index]
		if char == 'B':
			if string[index + 1] == 'G':
				(string[index], string[index + 1]) = (string[index + 1], string[index])
				index += 1
		index += 1
print(''.join(string))


spec = [int(n) for n in input().split()]
length = spec[0]
times = spec[1]
queue = str(input())
queueArr = list(queue)
i = 0
while i < times:
	j = 0
	while j < len(queueArr) - 1:
		if queueArr[j] == 'B' and queueArr[j + 1] == 'G':
			queueArr[j] = 'G'
			queueArr[j + 1] = 'B'
			j = j + 2
		else:
			j = j + 1
	i = i + 1
print(''.join(queueArr))


(n, t) = map(int, input().split())
s = list(input())
a = s.count('B')
if s[-1] == 'B':
	a -= 1
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = ('G', 'B')
			j += 1
		j += 1
print(''.join(s))


numTime = input().split(' ')
for i in range(len(numTime)):
	numTime[i] = int(numTime[i])
order = list(input())
swapList = []
for i in range(numTime[0]):
	swapList.append('unswapped')

def swap(pos1, pos2, aList):
	bList = aList[:]
	aList[pos1] = bList[pos2]
	aList[pos2] = bList[pos1]
	return aList
for i in range(numTime[1]):
	for i in range(len(swapList)):
		swapList[i] = 'unswapped'
	for i in range(len(order)):
		if i == max(range(len(order))):
			pass
		elif order[i] == 'B' and order[i + 1] == 'G' and (swapList[i] == 'unswapped') and (swapList[i + 1] == 'unswapped'):
			swap(i, i + 1, order)
			swapList[i] = 'swapped'
			swapList[i + 1] = 'swapped'
print(''.join(order))


def once(s):
	i = 1
	c = ''
	while i < len(s):
		if s[i] == 'G' and s[i - 1] == 'B':
			c += 'GB'
			i += 1
			if i + 1 == len(s):
				c += s[i]
		else:
			c += s[i - 1]
			if i + 1 == len(s):
				c += s[i]
		i += 1
	return c
(n, t) = [int(a) for a in input().split()]
s = input()
if n == 1:
	print(s)
	quit(0)
for j in range(0, t):
	s = once(s)
print(s)


(n, t) = map(int, input().split())
s = input()
l = list(s)
for _ in range(t):
	a = l
	ls = []
	for i in range(len(a) - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			ls.append(i)
	for i in ls:
		(l[i], l[i + 1]) = (l[i + 1], l[i])
print(''.join(l))


(n, t) = [int(e) for e in input().split()]
s = input()

def task(n, t, initial):
	last = [e == 'B' for e in initial]
	for _ in range(t):
		cur = list(last)
		for i in range(len(last) - 1):
			if last[i] and (not last[i + 1]):
				cur[i] = False
				cur[i + 1] = True
		last = cur
	return ''.join(['B' if e else 'G' for e in last])
print(task(n, t, s))


(n, t) = list(map(int, input().split()))
q = input()
q = list(q)
q_new = []
x = None
for i in range(t):
	x = None
	for j in range(len(q) - 1):
		if (q[j] == 'B') & (q[j + 1] == 'G') & (x != j):
			(q[j], q[j + 1]) = (q[j + 1], q[j])
			x = j + 1
		else:
			(q[j], q[j + 1]) = (q[j], q[j + 1])
print(''.join(q))


import re
(z, y) = [int(x) for x in input().split()]
p = input()
for i in range(y):
	s = re.sub('BG', 'GB', p)
	p = s
print(s)


(n, t) = (int(i) for i in input().split())
l = input()
p = [i for i in l]
p.append('A')
while t:
	i = 0
	while i < n:
		if p[i] == 'B' and p[i + 1] == 'G':
			p[i] = 'G'
			p[i + 1] = 'B'
			i += 1
		i += 1
	t -= 1
p = p[:-1]
print(''.join(p))


INPUT_VALUE_A = str(input()).split(' ')
INPUT_VALUE_B = str(input())
for i in range(0, int(INPUT_VALUE_A[1])):
	INPUT_VALUE_B = INPUT_VALUE_B.replace('BG', 'GB')
	if 'BG' not in INPUT_VALUE_B:
		break
print(INPUT_VALUE_B)


(n, k) = map(int, input().split())
s = input()
aaa = bbb = 0
while aaa < k:
	while bbb < n - 1:
		if s[bbb] == 'B' and s[bbb + 1] == 'G':
			s = s[0:bbb] + 'GB' + s[bbb + 2:]
			bbb = bbb + 2
		else:
			s = s
			bbb = bbb + 1
	aaa = aaa + 1
	bbb = 0
print(s)


(n, t) = [int(x) for x in input().split()]
fila = [c for c in input()]
n = len(fila)
for _ in range(t):
	i = 0
	while i < n - 1:
		if fila[i] == 'B' and fila[i + 1] == 'G':
			(fila[i], fila[i + 1]) = ('G', 'B')
			i += 1
		i += 1
print(''.join(fila))


(l, s) = list(map(int, input().split()))
b = input()
for i in range(s):
	b = b.replace('BG', 'GB')
print(b)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	(n, t) = map(int, input().split())
	s = str(input())
	for i in range(t):
		s = s.replace('BG', 'GB')
	print(s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, t) = map(int, input().split())
st = input()
s = []
for i in range(n):
	s.append(st[i])
temp = ''
while t > 0:
	t -= 1
	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 = i + 2
		else:
			i = i + 1
print(''.join(s))


import sys
(n, m) = map(int, input().split())
s = list(input())
for i in range(m):
	a = []
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			a.append(j)
	for x in a:
		(s[x], s[x + 1]) = ('G', 'B')
for c in s:
	sys.stdout.write(c)


(n, t) = map(int, input().split())
s = input()
s = list(s)
for k in range(t):
	fl = 0
	ind = 0
	for i in range(1, n):
		if i == ind + 2:
			ind = 0
			fl = 0
		if s[i] == 'G' and s[i - 1] == 'B' and (fl == 0):
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			fl = 1
			ind = i
print(''.join(s))


nAndt = list(map(int, input().split()))
n = nAndt[0]
t = nAndt[1]
string = input()
for i in range(t):
	string = string.replace('BG', 'GB')
else:
	print(string)


def solve():
	nums = list(map(int, input().split()))
	seq = [x for x in str(input())]
	length = nums[0]
	time = nums[1]
	prev = None
	i = 0
	for _ in range(time):
		for x in seq:
			if i == 0:
				prev = x
			else:
				if prev == 'B' and x == 'G':
					seq.insert(i, seq.pop(i - 1))
				prev = x
			i += 1
		i = 0
	print(''.join(seq))
solve()


(n, t) = map(int, input().split())
s = input()
x = 0
l = []
while x < len(s):
	l = l + [s[x]]
	x += 1
while t > 0:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			temp = l[i]
			l[i] = l[i + 1]
			l[i + 1] = temp
			i += 2
		else:
			i += 1
	t -= 1
x = 0
a = ''
while x < len(l):
	a = a + l[x]
	x += 1
print(a)


(x, t) = map(int, input().split())
m = list(input())
if x == len(m):
	for i in range(t):
		j = 0
		while j < len(m) - 1:
			if m[j] == 'B' and m[j + 1] == 'G':
				(m[j], m[j + 1]) = (m[j + 1], m[j])
				j = j + 1
			j = j + 1
m = ''.join(m)
print(m)


n = list(map(int, input().strip().split()))
a = input()
for i in range(n[1]):
	a = a.replace('BG', 'GB')
print(a)


(n, t) = map(int, input().split())
l = list(input())
for y in range(t):
	x = 1
	while x < n:
		if l[x - 1] == 'B' and l[x] == 'G':
			l[x - 1] = 'G'
			l[x] = 'B'
			x += 1
		x += 1
print(*l, sep='')


def restructure_queue(s, n):
	q = list(s)
	for _ in range(n):
		for i in range(len(s) - 1):
			if s[i] < s[i + 1]:
				(q[i + 1], q[i]) = (q[i], q[i + 1])
		s = ''.join(q)
	return ''.join(q)
(n, t) = map(int, input().split(' '))
seq = input()
print(restructure_queue(seq, t))


(n, t) = list(map(int, input().split()))
s = input()
for x in range(1, t + 1):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = tuple(map(int, input().split()))
s = list(input())
li = []
for i in range(len(s)):
	if s[i] == 'B':
		li.append(i)
for j in range(t):
	for i in range(len(li)):
		try:
			if s[li[i] + 1] == 'G':
				s[li[i]] = 'G'
				s[li[i] + 1] = 'B'
				li[i] = li[i] + 1
		except:
			pass
s = ''.join(s)
print(str(s))


def solution():
	(n, t) = [int(i) for i in input().split()]
	q = list(input())
	for i in range(t):
		i = 0
		while i < len(q) - 1:
			if q[i] == 'B' and q[i + 1] == 'G':
				(q[i], q[i + 1]) = (q[i + 1], q[i])
				i += 1
			i += 1
	print(''.join(q))
solution()


inp = lambda : map(int, input().split())
(n, t) = inp()
s = list(input())
for j in range(t):
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(s))


(n, t) = map(int, input().split())
alignment = list(input())
for i in range(t):
	j = 1
	while j < len(alignment):
		if alignment[j] == 'G' and alignment[j - 1] == 'B':
			(alignment[j], alignment[j - 1]) = (alignment[j - 1], alignment[j])
			j += 1
		j += 1
print(''.join(alignment))


(n, t) = input().split()
s = list(input())
(n, t) = (int(n), int(t))
for i in range(t):
	c = 0
	while c < n - 1:
		if s[c] == 'B' and s[c + 1] == 'G':
			(s[c], s[c + 1]) = (s[c + 1], s[c])
			c += 2
		else:
			c += 1
ans = ''
for c in s:
	ans += c
print(ans)


(a, b) = map(int, input().split())
c = input()
d = []
for i in c:
	d.append(i)
for i in range(b):
	if len(d) == 1:
		break
	i = 0
	while True:
		if d[i] == 'B' and d[i + 1] == 'G':
			temp = d[i]
			d[i] = d[i + 1]
			d[i + 1] = temp
			i = i + 2
		else:
			i = i + 1
		if i > len(d) - 2:
			break
print(''.join(d))


all = [int(i) for i in input().split()]
n = all[0]
t = all[1]
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
queue = list(input())
for i in range(t):
	prop = 0
	for j in range(len(queue) - 1):
		if prop == 1:
			prop = 0
			continue
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j], queue[j + 1]) = ('G', 'B')
			prop = 1
for i in queue:
	print(i, end='')
print()


def main():
	(n, t) = tuple(map(int, input().rstrip().split()))
	S = input().rstrip()
	for _ in range(t):
		S = S.replace('BG', 'GB')
	print(S)
main()


(q, sec) = map(int, input().split())
a = [i for i in input()]
for i in range(sec):
	j = 0
	while j < len(a) - 1:
		if a[j + 1] == 'G' and a[j] == 'B':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			j += 2
		else:
			j += 1
print(*a, sep='')


(n, k) = map(int, input().split())
a = list(input())
for t in range(k):
	i = 1
	while i < n:
		if a[i] == 'G':
			(a[i], a[i - 1]) = (a[i - 1], a[i])
			i += 1
		i += 1
for i in a:
	print(i, end='')


(_, t) = map(int, input().split())
students = list(input().rstrip())
for __ in range(t):
	prev_swap = False
	for (i, a) in enumerate(students[:-1]):
		if prev_swap:
			prev_swap = False
		elif a == 'B' and students[i + 1] == 'G':
			(students[i], students[i + 1]) = (students[i + 1], students[i])
			prev_swap = True
print(''.join(students))


(n, t) = map(int, input().split())
p = input()
for I in range(t):
	i = 1
	while i < n:
		if p[i - 1] == 'B' and p[i] == 'G':
			p = p[:i - 1] + p[i] + p[i - 1] + p[i + 1:]
			i += 2
		else:
			i += 1
print(p)


temp = list(map(int, input().split()))
(n, t) = (temp[0], temp[1])
s = input()
for j in range(t):
	i = 0
	stri = ''
	while i + 1 < n:
		if s[i] == 'B' and s[i + 1] == 'G':
			stri += s[i + 1] + s[i]
			i += 2
		else:
			stri += s[i]
			i += 1
	if i + 1 == n:
		stri += s[i]
	s = stri
print(s)


(n, m) = [int(x) for x in input().split()]
s = input()
s = list(s)
for i in range(m):
	j = 0
	while j < n - 1:
		if s[j] is 'B' and s[j + 1] is 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += 1
		j += 1
for j in range(n):
	print(s[j], end='')
print()


import re
n = list(input().split())
t = int(n[1])
n = int(n[0])
s = input()
for j in range(t):
	a = list((m.start() for m in re.finditer('B', s)))
	for i in a:
		s = s[:i] + s[i:i + 2][::-1] + s[i + 2:]
print(s)


(p, q) = map(int, input().split())
r = input()
for i in range(q):
	r = r.replace('BG', 'GB')
print(r)


(q, t) = input().split()
T = list(input())
S = ''
i = 0
for r in range(int(t)):
	i = 0
	while i < len(T) - 1:
		if T[i] == 'B' and T[i + 1] == 'G':
			T[i] = 'G'
			T[i + 1] = 'B'
			i += 2
		else:
			i += 1
d = S.join(T)
print(d)


n = [int(char) for char in input().split()]
string = input()
trial = 0
while trial < n[1]:
	ans = ''
	b = string.split('BG')
	trial += 1
	for items in range(len(b) - 1):
		ans = ans + b[items] + 'GB'
	string = ans + b[-1]
print(string)


(n, t) = list(map(int, input().strip().split(' ')))
string = list(input())
for _ in range(t):
	i = 0
	while i < len(string) - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			(string[i], string[i + 1]) = (string[i + 1], string[i])
			i += 2
			continue
		i += 1
result = ''
for i in string:
	result = result + i
print(result)


(n, t) = map(int, input().split())
string = input()
string = list(string)
for j in range(0, t):
	swp = []
	for i in range(0, len(string) - 1):
		swp.append(0)
	for i in range(0, int(len(string) - 1)):
		if string[i] < string[i + 1]:
			swp[i] = 1
	for i in range(0, len(string) - 1):
		if swp[i]:
			(string[i], string[i + 1]) = (string[i + 1], string[i])
res = ''.join(string)
print(res)


(length, time) = map(int, input().split())
s = list(input())
for i in range(time):
	boys_backward = []
	for j in range(length - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			boys_backward.append(j)
	for k in boys_backward:
		s[k] = 'G'
		s[k + 1] = 'B'
print(''.join(s))


(n, t) = map(int, input().split())
q = list(input())
for _ in range(t):
	i = 1
	changed = False
	while i != n:
		if changed:
			changed = False
			i += 1
			continue
		if q[i - 1] == 'B' and q[i] == 'G':
			q[i - 1] = 'G'
			q[i] = 'B'
			changed = True
		i += 1
print(''.join(q))


test = list(map(int, input().split(' ')))
n = test[0]
k = test[1]
s = list(input())
i = 0
t = []
while i < k:
	j = 0
	while j < n:
		if s[j] == 'G':
			t.append('G')
			j += 1
		elif s[j] == 'B':
			if j == n - 1:
				t.append('B')
				j += 1
			elif s[j + 1] == 'B':
				t.append('B')
				j += 1
			elif s[j + 1] == 'G':
				t.append('G')
				t.append('B')
				j += 2
	s = t
	t = []
	i += 1
print(''.join(s))


(m, n) = map(int, input().split())
z = input()
while n:
	z = z.replace('BG', 'GB')
	n -= 1
print(z)


import sys
inp = sys.stdin
(n, t) = inp.readline().split()
(n, t) = (int(n), int(t))
s = inp.readline()
a = []
for i in range(n):
	a.append(s[i])
for i in range(t):
	j = 0
	while j < n - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			j += 1
		j += 1
print(''.join(a))


(n, t) = list(map(int, input().split()))
quene = input()
i = 0

def swapBG(quene, jboy):
	newquene = quene[:jboy] + 'GB' + quene[jboy + 2:]
	return newquene
for l in range(t):
	while i < n - 1:
		if quene[i] == 'B' and quene[i + 1] == 'G':
			quene = swapBG(quene, i)
			i = i + 1
		i = i + 1
	i = 0
print(quene)


from sys import stdin
input = stdin.readline

def queue(n, t):
	a = list(input().strip())
	for i in range(t):
		c = list(a)
		for j in range(n - 1):
			if a[j] == 'B' and a[j + 1] == 'G':
				(c[j], c[j + 1]) = (c[j + 1], c[j])
		a = c
	return ''.join(a)
print(queue(*map(int, input().split())))


char = input()
list1 = list(char.split())
list2 = list(input())
i = 0
while i <= int(list1[1]) - 1:
	j = 0
	while j <= int(list1[0]) - 2:
		if list2[j] is 'B':
			if list2[j + 1] is 'G':
				list2[j] = 'G'
				list2[j + 1] = 'B'
				j = j + 2
			else:
				j = j + 1
		else:
			j = j + 1
	i += 1
for i in list2:
	print(i, end='')


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	ans = ''
	for i in range(len(s)):
		if s[i] == 'G':
			if i != 0 and s[i - 1] == 'B':
				ans += 'B'
				continue
			else:
				ans += 'G'
				continue
		elif s[i] == 'B':
			if i + 1 < n and s[i + 1] == 'G':
				ans += 'G'
				continue
			else:
				ans += 'B'
				continue
	s = ans
print(ans)


(n, m) = input().split()
l = input()
for i in range(0, int(m)):
	l = l.replace('BG', 'GB')
print(''.join(l))


(z, b) = map(int, input().split(' '))
a = input()
for j in range(b):
	a = a.replace('BG', 'GB')
print(a)


(n, t) = map(int, input().split())
a = input()
i = 0
while i < t:
	if a.find('BG') != -1:
		a = a.replace('BG', 'GB')
		i += 1
	else:
		break
print(a)


(n, t) = [int(x) for x in input().split()]
s = input()
L = []
L1 = []
for y in s:
	L.append(y)
	L1.append(y)
for j in range(t):
	for i in range(len(s) - 1):
		if L1[i] == 'B' and L1[i + 1] == 'G':
			(L[i], L[i + 1]) = (L[i + 1], L[i])
	L1 = L[:]
print(''.join(L1))


inp = list(input().split(' '))
n = int(inp[0])
t = int(inp[1])
arr = list(input())
counter = 1
i = 1
j = 1
while i <= t:
	j = 1
	while j < n:
		if arr[j - 1] == 'B' and arr[j] == 'G':
			arr[j] = 'B'
			arr[j - 1] = 'G'
			j += 1
		j += 1
	i += 1
quaue = ''.join(arr)
print(quaue)


(a, b) = map(int, input().split())
x = input()
l = [x]
for i in range(b):
	l.append(l[-1].replace('BG', 'GB'))
print(l[-1])


from math import log, ceil, floor

def find_line_arrangement(num_children, time_in_queue):
	line_str = input()
	line_length = len(line_str)
	if line_str == ''.join(sorted(line_str, reverse=True)):
		print(line_str)
		return 0
	else:
		pos_iterator = 0
		ignore_start = 0
		while line_str[pos_iterator] == 'G':
			ignore_start += 1
			pos_iterator += 1
		pos_iterator = -1
		ignore_end = 0
		while line_str[pos_iterator] == 'B':
			ignore_end += 1
			pos_iterator -= 1
		line_list = list(line_str[ignore_start:line_length - ignore_end])
		line_length = len(line_list)
		num_seconds_passed = 0
		while num_seconds_passed < time_in_queue:
			pos_iter = 0
			while pos_iter < line_length - 1:
				if line_list[pos_iter] == 'B' and line_list[pos_iter + 1] == 'G':
					(line_list[pos_iter], line_list[pos_iter + 1]) = (line_list[pos_iter + 1], line_list[pos_iter])
					pos_iter += 2
				else:
					pos_iter += 1
			if line_list == sorted(line_list, reverse=True):
				break
			num_seconds_passed += 1
	if ignore_end == 0:
		line_str = line_str[0:ignore_start] + ''.join(line_list)
	else:
		line_str = line_str[0:ignore_start] + ''.join(line_list) + line_str[-ignore_end:]
	print(line_str)
input_str = input()
input_list = list(map(int, input_str.split(' ')))
n_children = input_list[0]
total_time = input_list[1]
find_line_arrangement(n_children, total_time)


(n, t) = list(map(int, input().split()))
queue = list(input())
for _ in range(t):
	to_change = []
	for i in range(n):
		if queue[i] == 'G':
			if queue[i - 1] != 'G':
				to_change.append(i)
	for j in to_change:
		if j != 0:
			(queue[j], queue[j - 1]) = (queue[j - 1], queue[j])
print(''.join(queue))


y = list(map(int, input().split()))
n = y[0]
k = y[1]
s = input()
l = []
for i in s:
	l.append(i)
while k != 0:
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 1
		i += 1
	k -= 1
print(''.join(l))


(n, t) = map(int, input().split())
text = input()
text = [i for i in text] + [' ', ' ', ' ']
for i in range(t):
	indexes = []
	for j in range(n):
		if text[j] == 'B' and text[j + 1] == 'G':
			indexes.append([j, j + 1])
	for j in indexes:
		(text[j[0]], text[j[1]]) = (text[j[1]], text[j[0]])
print(''.join(text))


n_and_t = [int(x) for x in input().split(' ')]
line = list(input())
new_string = ''
counter = 0
while n_and_t[1] > 0:
	i = 0
	while i < len(line) - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			(line[i], line[i + 1]) = (line[i + 1], line[i])
			i += 1
		i += 1
	n_and_t[1] -= 1
for letter in range(len(line)):
	new_string += line[letter]
print(new_string)


(l, n) = map(int, input().split())
string = input()
lst = list(string)
for j in range(n):
	i = 0
	while i < l - 1:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			(lst[i], lst[i + 1]) = (lst[i + 1], lst[i])
			i += 1
		i += 1
print(''.join(lst))


(n, m) = list(map(int, input().split()))
string = input()
for j in range(0, m):
	s = ''
	flag = 0
	for i in range(n):
		if i != n - 1:
			if string[i] == 'B':
				if string[i + 1] == 'G':
					s = ''.join((s, 'GB'))
					flag = 1
					continue
				else:
					s = ''.join((s, 'B'))
			elif flag == 0:
				s = ''.join((s, string[i]))
			flag = 0
		elif string[i] == 'G' and string[i - 1] != 'B':
			s = ''.join((s, string[i]))
			break
		elif string[i] == 'G' and string[i - 1] == 'B':
			break
		else:
			s = ''.join((s, string[i]))
	string = s
print(string)


(n, t) = [int(x) for x in input().strip().split()]
s = input()
for i in range(t):
	change = False
	ns = [c for c in s]
	j = 1
	while j < len(ns):
		if ns[j] == 'G' and ns[j - 1] == 'B':
			(ns[j], ns[j - 1]) = (ns[j - 1], ns[j])
			change = True
			j += 2
		else:
			j += 1
	s = ''.join(ns)
	if not change:
		break
print(s)


from sys import stdin, stdout

def main():
	(n, t) = map(int, stdin.readline().rstrip().split())
	line = str(stdin.readline().rstrip())
	for time in range(0, t):
		index = 0
		while index < n - 1:
			if line[index] == 'B' and line[index + 1] == 'G':
				line = line[:index] + 'GB' + line[index + 2:]
				index += 1
			index += 1
	stdout.write(str(line) + '\n')
main()


l = input().split()
n = int(l[0])
t = int(l[1])
q = input()
l = []
s = 0
while s < t:
	for i in range(n - 1):
		if q[i] == 'B' and q[i + 1] == 'G':
			l.append(int(i))
	for i in l:
		q = q[:i] + 'G' + q[i + 1:]
		q = q[:i + 1] + 'B' + q[i + 2:]
	s += 1
	l = []
print(q)


nt = input().split(' ')
nt[0] = int(nt[0])
nt[1] = int(nt[1])
st = input()
l = list(st)
nst = ''
while nt[1] > 0:
	i = 0
	while i < nt[0] - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 1
		i += 1
	nt[1] -= 1
for i in range(nt[0]):
	nst += l[i]
print(nst)


ch1 = str(input())
L1 = ch1.split()
n = int(L1[0])
t = int(L1[1])
ch = str(input())
res = ''
while t != 0:
	t -= 1
	res = ''
	L = list()
	for c in ch:
		L.append(c)
	for i in range(1, len(ch)):
		if ch[i] == 'G' and ch[i - 1] == 'B':
			(L[i], L[i - 1]) = (L[i - 1], L[i])
	ch = ''.join(L)
print(ch)


i = input().split()
n = int(i[0])
t = int(i[1])
q = list(input())
z = list(q)
for c in range(t):
	for x in range(n - 1):
		if q[x] == 'B' and q[x + 1] == 'G':
			z[x] = z[x].replace('B', 'G')
			z[x + 1] = z[x + 1].replace('G', 'B')
	q = list(z)
print(''.join(map(str, q)))


i = input
(t, c) = (int(i()[-2:]), i())
while t:
	c = c.replace('BG', 'GB')
	t -= 1
print(c)


(a, b) = map(int, input().split())
s = input()
n = []
for i in s:
	if i == 'B':
		n.append(0)
	else:
		n.append(1)
for times in range(b):
	n1 = []
	for nn in range(a):
		n1.append(0)
	for i in range(a):
		if n[i - 1] == 0 and n[i] == 1 and (i - 1 >= 0):
			n1[i - 1] = 1
			n1[i] = 0
		elif n[i] == 0:
			n1[i] = 0
		else:
			n1[i] = 1
	n = n1
s = ''
for i in n:
	if i == 0:
		s += 'B'
	elif i == 1:
		s += 'G'
print(s)


[n, t] = map(int, input().split())
string = input()
string2 = string
for j in range(t):
	for i in range(n - 1):
		if string[i] == 'B' and string[i + 1] == 'G' and (i < n - 1):
			string2 = string2[:i] + 'G' + 'B' + ''.join([string2[i + 2:] if i != n - 2 else ''])
	string = string2
print(string2)


def changeQueueOrder(q, t):
	for i in range(t):
		changed_queue = ''
		pointerOne = 0
		pointerTwo = 1
		j = 0
		while j < len(q) - 1:
			if q[j] == 'B' and q[j + 1] == 'G':
				changed_queue += q[j + 1] + q[j]
				j += 2
			else:
				changed_queue += q[j]
				j += 1
		changed_queue += q[j] if j < len(q) else ''
		q = changed_queue
	print(q)

def main():
	(n, t) = input().split()
	q = input()
	changeQueueOrder(q, int(t))
main()


(n, t) = [int(x) for x in input().split()]
line = list(input())
for a in range(t):
	pos = 0
	for i in line:
		pos += 1
		if pos > len(line) - 1:
			break
		elif line[pos - 1] == 'B' and line[pos] == 'G':
			line[pos - 1] = 'G'
			line[pos] = 'B'
			pos += 1
print(''.join(line))


(n, t) = list(map(int, input().split()))
queue = str(input())
q = []
for j in queue:
	q.append(j)
q1 = q[:]
for i in range(t):
	for j in range(n):
		if q[j] == 'B' and j != n - 1:
			if q[j + 1] == 'G':
				q1[j] = 'G'
				q1[j + 1] = 'B'
	q = q1[:]
print(''.join(q))


t = int(input().split()[1])
queue = [x for x in input()]
for _ in range(t):
	new_queue = queue[:]
	for i in range(len(queue) - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			new_queue[i] = 'G'
			new_queue[i + 1] = 'B'
	queue = new_queue
	result = ''.join(queue)
print(result)


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
list = list(s)
for i in range(t):
	k = 0
	while True:
		if k >= len(list) - 1:
			break
		if list[k] == 'B' and list[k + 1] == 'G':
			t = list[k]
			list[k] = list[k + 1]
			list[k + 1] = t
			k += 1
		k += 1
print(*list, sep='')


(n, t) = input().split()
n = int(n)
t = int(t)
c = input()
b = list(c)
d = ''
while t > 0:
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 1
		i += 1
	t -= 1
for i in range(len(b)):
	d += b[i]
print(d)


temp = input().split()
b = int(temp[1])
del temp
s = input()
le = len(s)
for j in range(b):
	temp = ''
	flag = False
	for i in range(le):
		if i != le - 1:
			if flag:
				temp += 'B'
				flag = False
			elif s[i] == 'B' and s[i + 1] == 'G':
				temp += 'G'
				flag = True
			else:
				temp += s[i]
		elif flag:
			temp += 'B'
		else:
			temp += s[i]
	s = temp
print(s)


(n, t) = map(int, input().split())
a = input()
z = []
for k in range(n):
	z.append(a[k])
for j in range(t):
	i = 0
	while i < n - 1:
		if z[i] == 'B' and z[i + 1] == 'G':
			(z[i], z[i + 1]) = (z[i + 1], z[i])
			if i < n - 2:
				i = i + 1
			else:
				break
		i = i + 1
a = z[0]
for i in range(n - 1):
	a = a + z[i + 1]
print(a)


(N, t) = list(map(int, input().split()))
s = input()
for time in range(t):
	ans = ''
	i = 0
	while i <= N - 1:
		if s[i] == 'B' and i != N - 1 and (s[i + 1] == 'G'):
			ans += 'GB'
			i += 2
		else:
			ans += s[i]
			i += 1
	s = ans
print(ans)


(m, n) = map(int, input().split())
l = list(input())
while n > 0:
	n -= 1
	flag = False
	for i in range(m - 1):
		if flag == True:
			flag = False
			continue
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = ('G', 'B')
			flag = True
print(''.join(l))


(n, t) = map(int, input().split())
S = input()
for i in range(t):
	i = 0
	while i < n - 1:
		if S[i] == 'B' and S[i + 1] == 'G':
			S = S[:i] + 'G' + 'B' + S[i + 2:]
			i = i + 2
		else:
			i = i + 1
print(S)


(n, t) = tuple(map(int, input().split()))
a = str(input())
c = lambda a: list((i for i in a))
d = c(a)
for k in range(t):
	i = 0
	while i < n - 1:
		if d[i] == 'B' and d[i + 1] == 'G':
			d[i] = 'G'
			d[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(d))


(n, t) = [int(i) for i in input().split()]
s = input()
s = list(s)
n = n - 1
for i in range(t):
	j = 0
	while j < n:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 2
		else:
			j += 1
print(*s, sep='')


(n, t) = map(int, input().split())
s = list(input())
bC = 0
gC = 0
i = -2
j = n + 1
for x in range(n):
	if s[x] == 'B' and bC == 0:
		bC += 1
		i = x - 1
	if s[x] == 'G':
		j = x + 1
		gC += 1
if gC != 0 and bC != 0:
	while t > 0 and i < j:
		x = i + 1
		while x < j:
			if s[x] == 'B' and s[x + 1] == 'G':
				s[x] = 'G'
				s[x + 1] = 'B'
				if x == i + 1:
					i += 1
				if x + 1 == j - 1:
					j -= 1
				x += 2
			else:
				x += 1
		t -= 1
print(''.join(s))


(n, t) = map(int, input().split())
word = list(input())
indices = []
for i in range(t):
	for j in range(0, n - 1):
		if word[j] == 'B' and word[j + 1] != 'B':
			indices.append(j)
	if word.count('G') != 0:
		for x in indices:
			(word[x], word[x + 1]) = ('G', 'B')
print(*word, sep='')


(a, b) = input().split()
c = list(input())
for i in range(int(b)):
	j = 0
	while True:
		if j >= len(c) - 1:
			break
		if c[j] == 'B' and c[j + 1] == 'G':
			(c[j], c[j + 1]) = (c[j + 1], c[j])
			j += 2
			if j > len(c) - 1:
				break
		else:
			j += 1
print(''.join(c))


(n, t) = map(int, input().split())
st = input()
l = list(st)
for j in range(t):
	l1 = []
	for i in range(n - 1):
		if l[i] == 'B':
			l1.append(i)
	for i in l1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
print(''.join(l))


(n, m) = map(int, input().split())
l = list(input())
for i in range(m):
	k = 0
	while k < n - 1:
		if l[k] == 'B' and l[k + 1] == 'G':
			(l[k], l[k + 1]) = (l[k + 1], l[k])
			k = k + 2
		else:
			k = k + 1
r = ''
for i in l:
	r = r + i
print(r)


(n, k) = map(int, input().strip().split())
string = list(input())
sol = ''
for i in range(0, k):
	j = 0
	while j < len(string) - 1:
		if string[j] == 'B':
			if string[j + 1] == 'G':
				string[j] = 'G'
				string[j + 1] = 'B'
				j += 1
		j += 1
print(sol.join(string))


(a, b) = map(int, input().split())
m = str(input())
c = []
for l in m:
	c += l
for i in range(b):
	j = 0
	while j < a - 1:
		if c[j] == 'B' and c[j + 1] == 'G':
			c[j] = 'G'
			c[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(c))


(a, b) = [int(i) for i in input().split()]
c = list(input())

def abc(lista, tamanho):
	pos = []
	for i in range(tamanho):
		if lista[i] == 'B':
			pos.append(i)
	return pos
for i in range(b):
	temp = abc(c, a)
	for k in temp:
		if k + 1 == a:
			continue
		elif c[k + 1] == 'B':
			continue
		else:
			(c[k], c[k + 1]) = (c[k + 1], c[k])
print(''.join(c))


(n, t) = map(int, input().split())
s = input()
arr = [x for x in s]
while t > 0:
	i = 0
	while i < n:
		if arr[i] == 'B' and i != n - 1 and (arr[i + 1] == 'G'):
			(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
			i += 1
		i += 1
	t -= 1
print(*arr, sep='')


numbers = input().split()
children = int(numbers[0])
time = int(numbers[1])
s = [char for char in input()]
for j in range(time):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
l = list(s)
for i in range(t):
	j = 0
	while j < n - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			temp = l[j]
			l[j] = l[j + 1]
			l[j + 1] = temp
			j = j + 1
		j = j + 1
s2 = ''.join(l)
print(s2)


a = input().split(' ')
string = input()
string2 = ''
for i in range(int(a[1])):
	if i > 0:
		string = string2
		string2 = ''
	if 'BG' in string:
		li = string.split('BG')
		for j in range(len(li) - 1):
			string2 = string2 + li[j]
			string2 = string2 + 'GB'
		string2 = string2 + li[len(li) - 1]
	else:
		string2 = string
print(string2)


(a, b) = [int(i) for i in input().split()]
s = list(input())
count = 0
i = 0
while count < b:
	i = 0
	while i < len(s) - 1:
		if s[i + 1] == 'G' and s[i] == 'B':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
	count += 1
print(*s, sep='')


def swap(s, i):
	l = list(s)
	l[i] = 'G'
	l[i + 1] = 'B'
	s = ''
	s = s.join(l)
	return s
(ql, t) = map(int, input().split())
q = input()
n = len(q)
while t > 0:
	i = 0
	while i < n:
		if i == n - 1:
			break
		elif q[i] == 'B' and q[i + 1] == 'G':
			q = swap(q, i)
			i += 2
		else:
			i += 1
	t -= 1
print(q)


(n, t) = map(int, str(input()).split())
q = list(input())
flag = 0
for i in range(0, t):
	for k in range(0, len(q) - 1):
		if q[k] == 'B' and q[k + 1] == 'G' and (flag == 0):
			q[k] = 'G'
			q[k + 1] = 'B'
			flag = 1
		elif flag == 1:
			flag = 0
	flag = 0
print(''.join(q))


nt = [int(x) for x in input().split()]
data = list(input())
while nt[1] > 0:
	i = 0
	while i < nt[0] - 1:
		if data[i] == 'B' and data[i + 1] == 'G':
			temp = data[i]
			data[i] = data[i + 1]
			data[i + 1] = temp
			i += 1
		i += 1
	nt[1] -= 1
print(''.join(data))


a = input()
(n, t) = ('', '')
i = 0
while a[i] != ' ':
	n += a[i]
	i += 1
n = int(n)
for i in range(i + 1, len(a)):
	t += a[i]
t = int(t)
t0 = t
a = input()
ans = ''
while t != 0:
	i = 0
	t -= 1
	while i < n:
		if i < n - 2 and a[i] == 'B' and (a[i + 1] == 'G'):
			ans += 'GB'
			i += 2
			continue
		elif i == n - 2 and a[i] == 'B' and (a[i + 1] == 'G'):
			ans += 'GB'
			break
		if i != n - 1:
			ans += a[i]
			i += 1
		else:
			ans += a[i]
			i += 1
			break
	a = ans[len(ans) - n:]
print(a)


(n, t) = map(int, input().split())
s = list(input())
boys = []
for i in range(n):
	if s[i] == 'B':
		boys.append(i)
while t != 0:
	for i in range(len(boys)):
		if boys[i] + 1 < n and s[boys[i] + 1] == 'G':
			(s[boys[i]], s[boys[i] + 1]) = (s[boys[i] + 1], s[boys[i]])
			boys[i] += 1
	t -= 1
print(''.join(s))


(n, t) = [int(i) for i in input().split()]
x = list(input())
t0 = 0
while t0 < t:
	i = 0
	while i < n - 1:
		if x[i] == 'B' and x[i + 1] == 'G':
			(x[i], x[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
	t0 += 1
print(''.join(x))


(_, k) = (int(i) for i in input().split())
line = input()
for i in range(k):
	line = line.replace('BG', 'GB')
print(line)


l1 = input().strip().split()
t = int(l1[1])
queue = input()
for T in range(t):
	newqueue = [[' ', True] for i in range(len(queue))]
	for i in range(len(queue)):
		if i < len(queue) - 1 and queue[i + 1] == 'G' and (queue[i] == 'B'):
			newqueue[i + 1] = ['B', False]
			newqueue[i] = ['G', False]
		elif newqueue[i][1]:
			newqueue[i] = [queue[i], False]
	queue = ''
	for person in newqueue:
		queue += person[0]
print(queue)


import copy
(a, b) = map(int, input().split())
l = input()
m = len(l)
Line = []
for i in range(m):
	Line.append(l[i])
while b > 0:
	b -= 1
	s = [0] * m
	for i in range(m - 1):
		if Line[i] == 'B' and Line[i + 1] == 'G':
			s[i] = 1
		else:
			continue
	for i in range(m - 1):
		if s[i] == 1:
			(Line[i], Line[i + 1]) = (Line[i + 1], Line[i])
		else:
			continue
for i in range(m):
	print(Line[i], end='')


(size, time) = input().split()
(size, time) = (int(size), int(time))
queue = str(input())
list_queue = list(queue)
i = 0
while i < len(list_queue) - 1:
	if list_queue[i] == 'B' and list_queue[i + 1] == 'G':
		temp = list_queue[i]
		list_queue[i] = list_queue[i + 1]
		list_queue[i + 1] = temp
		i += 2
	else:
		i += 1
	if i >= size - 1 and time > 1:
		i = 0
		time -= 1
		continue
print(''.join(list_queue))


(n, t) = input().split()
s = input()
a = list(s)
a1 = list(s)
k = 0
for i in range(int(t)):
	a = a1.copy()
	for j in range(int(n) - 1):
		if a[j] == 'B' and a[j + 1] == 'G':
			a1[j] = 'G'
			a1[j + 1] = 'B'
print(''.join(a1))


from sys import stdin, stdout

def solve():
	(n, t) = map(int, stdin.readline().split())
	s = list(stdin.readline().strip())
	for _ in range(t):
		p = 0
		while p < n - 1:
			if s[p] == 'B' and s[p + 1] == 'G':
				s[p] = 'G'
				s[p + 1] = 'B'
				p += 1
			p += 1
	print(''.join(s))
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
t = 1
while t <= tcs:
	solve()
	t += 1


(n, t) = map(int, input().strip().split())
s = input()
a = []
for i in range(n):
	if s[i] == 'B':
		a.append(i)
for h in range(t):
	for i in range(len(a)):
		if a[i] + 1 not in a and a[i] + 1 < n:
			a[i] += 1
b = []
for i in range(n):
	if i in a:
		b.append('B')
	else:
		b.append('G')
print(*b, sep='')


(n, t) = input().split()
n = int(n)
t = int(t)
string = input().upper()
for each in range(0, t):
	string = string.replace('BG', 'GB')
print(string)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, t) = LI()
	s = [c for c in S()]
	for i in range(t):
		f = 1
		for j in range(n - 1):
			if f:
				if s[j] == 'B' and s[j + 1] == 'G':
					(s[j], s[j + 1]) = (s[j + 1], s[j])
					f = 0
				else:
					f = 1
			else:
				f = 1
	return ''.join(s)
print(main())


(n, t) = [int(e) for e in input().split()]
b = input().split()
a = []
for i in b[0]:
	a.append(i)
flag = False
for i in range(t):
	for j in range(len(a) - 1):
		if flag:
			flag = False
			continue
		if a[j] < a[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			flag = True
	flag = False
print(''.join(a))


def inpNum():
	return int(input())

def inpNums():
	return map(int, input().split())

def inpList():
	return list(map(int, input().split()))
(n, t) = inpNums()
q = list(input())
for _ in range(t):
	i = 1
	while i < n:
		if q[i] == 'G' and q[i - 1] == 'B':
			(q[i], q[i - 1]) = (q[i - 1], q[i])
			i += 1
		i += 1
print(''.join(q))


def trans(s):
	r = ''
	skip = False
	for i in range(len(s)):
		if i < len(s) - 1 and s[i:i + 2] == 'BG':
			r += 'GB'
			skip = True
		elif skip:
			skip = False
		else:
			r += s[i]
	return r
(n, t) = [int(x) for x in input().split()]
s = input()
for _ in range(t):
	s = trans(s)
print(s)


(n, l) = [int(x) for x in input().split(' ')]
ch = [x for x in input()]
for k in range(l):
	i = 1
	while i < len(ch):
		if ch[i - 1] < ch[i]:
			temp = ch[i]
			ch[i] = ch[i - 1]
			ch[i - 1] = temp
			if i < len(ch):
				i += 2
			else:
				i += 1
		else:
			i += 1
print(''.join(ch))


(a, b) = (input(), [i for i in input()])
for _ in range(int(a.split(' ')[1])):
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = ('G', 'B')
			i += 1
		i += 1
print(''.join(b))


(n, t) = map(int, input().split())
s = input()
l1 = [i for i in s]

def exchange(l):
	j = 1
	while j < len(l):
		if l[j - 1] == 'B' and l[j] == 'G':
			(l[j - 1], l[j]) = (l[j], l[j - 1])
			j = j + 2
		else:
			j += 1
	return l
for i in range(t):
	l1 = exchange(l1)
s1 = ''
for i in l1:
	s1 = s1 + i
print(s1)


(n, t) = input().split(' ')
s = input()
s = list(s)
t = int(t)
n = int(n)
while t > 0:
	i = 0
	while i < n - 1:
		if s[i] == 'B':
			if s[i + 1] == 'G':
				temp = s[i]
				s[i] = s[i + 1]
				s[i + 1] = temp
				i += 1
		i += 1
	t -= 1
print(''.join(s))


i1 = input().split()
n = int(i1[0])
t = int(i1[1])
s = input()
s = list(s)
for x1 in range(t):
	x = n - 1
	while x > 0:
		if s[x] == 'G' and s[x - 1] == 'B':
			s[x - 1] = 'G'
			s[x] = 'B'
			x = x - 1
		x = x - 1
for i in s:
	print(i, end='')


(n, t) = map(int, input().split())
s = str(input())
s_new = []
for i in range(n):
	s_new += s[i]
for i in range(t):
	ok = True
	for j in range(n - 1):
		if ok == False:
			ok = True
			continue
		if s_new[j] == 'B' and s_new[j + 1] == 'G':
			(s_new[j], s_new[j + 1]) = (s_new[j + 1], s_new[j])
			ok = False
print(''.join(s_new))


(n, t) = list(map(int, input().split(' ')))
kids = input()
charKids = list(kids)
i = 0
while t > 0:
	while i < len(charKids) - 1:
		if charKids[i] == 'B' and charKids[i + 1] == 'G':
			(charKids[i], charKids[i + 1]) = (charKids[i + 1], charKids[i])
			i += 2
		else:
			i += 1
	t -= 1
	i = 0
print(*charKids, sep='')


(h, t) = list(map(int, input().split()))
seq = list(input())
for i in range(t):
	final = []
	flag = False
	for j in range(h):
		if j < h - 1 and seq[j] == 'B' and (seq[j + 1] == 'G'):
			final.append(seq[j + 1])
			flag = True
			continue
		if flag == True:
			final.append(seq[j - 1])
			flag = False
		else:
			final.append(seq[j])
	seq = final.copy()
print(''.join(seq))


(n, t) = [int(x) for x in input().split()]
s = input().upper()
a = []
for j in range(n):
	a.append(s[j])
for k in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
for i in a:
	print(i, end='')


(m, n) = map(int, input().split())
a = input()
for i in range(1, n + 1):
	a = a.replace('BG', 'GB')
print(a)


import sys
lines = sys.stdin.readlines()
time = int(lines[0].strip().split(' ')[1])
sequence_string = lines[1].strip()
sequence_list = []
for item in sequence_string:
	sequence_list += [item]
for howmnaytime in range(0, time):
	i = 0
	while i < len(sequence_list) - 1:
		if sequence_list[i] == 'B' and sequence_list[i + 1] == 'G':
			sequence_list[i] = 'G'
			sequence_list[i + 1] = 'B'
			i += 2
		else:
			i += 1
answer = ''
for momo in sequence_list:
	answer += momo
print(answer)


t = input()
t = t.strip().split()
n = int(t[1])
l = list(input())
check = []
for _ in range(0, n):
	for i in range(0, len(l)):
		if len(l) == 1:
			break
		if i == 0:
			if l[i] == 'B' and l[i + 1] == 'G' and (i not in check):
				l[i] = 'G'
				l[i + 1] = 'B'
				check.append(i + 1)
		elif i != len(l) - 1 and i not in check:
			if l[i] == 'B' and l[i + 1] == 'G':
				l[i] = 'G'
				l[i + 1] = 'B'
				check.append(i + 1)
	check.clear()
for i in l:
	print(i, end='')


(a, b) = list(map(int, input().split()))
word = list(input())
for i in range(b):
	flag = True
	for j in range(a):
		if j == a - 1:
			continue
		if word[j] == 'B' and word[j + 1] == 'G' and flag:
			word.insert(j, 'G')
			del word[j + 2]
			flag = False
		else:
			flag = True
print(''.join(word))


(num, sec) = map(int, input().split())
a = list(input())
for time in range(0, sec):
	swap = []
	for i in range(num - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			swap.append(i)
	for i in swap:
		(a[i], a[i + 1]) = ('G', 'B')
print(''.join(a))


(q, t) = [int(x) for x in input().split()]
queue = [str(y) for y in input()]
for i in range(0, t, 1):
	j = 1
	while j < q:
		if queue[j] == 'G' and queue[j - 1] == 'B':
			queue[j - 1] = 'G'
			queue[j] = 'B'
			j = j + 1
		j = j + 1
print(''.join(queue))


a = input().split()
n = int(a[0])
t = int(a[1])
b = input()
x = 1
y = 0
z = ''
while x <= t and y < len(b) - 1:
	if b[y] == 'B' and b[y + 1] == 'G':
		z = z + b[y + 1] + b[y]
		y = y + 2
		if y == len(b) - 1:
			z = z + b[y]
	else:
		z = z + b[y]
		y = y + 1
		if y == len(b) - 1:
			z = z + b[y]
	if y >= len(b) - 1 and x < t:
		b = z
		z = ''
		x = x + 1
		y = 0
if len(b) == 1:
	z = b
print(z)


(n, k) = map(int, input().split())
s = input()
a = []
for i in s:
	a.append(i)
while k > 0:
	f = False
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			f = True
			i += 1
		i += 1
	if f == False:
		break
	k -= 1
print(''.join(a))


(a, b) = map(int, input().split())
n = input()
for i in range(b):
	s = n
	for j in range(1, a):
		if n[j] == 'G' and n[j - 1] == 'B':
			s = s[:j - 1] + 'G' + 'B' + s[j + 1:]
	n = s
print(s)


(n, t) = map(lambda x: int(x), input().split())
s = list(input())
for ts in range(t):
	i = n - 1
	while i > 0:
		if s[i - 1] == 'B' and s[i] == 'G':
			s[i - 1] = 'G'
			s[i] = 'B'
			i -= 1
		i -= 1
print(''.join(s))


import queue
(n, t) = tuple(map(int, input().split()))
line = list(input())
for _ in range(t):
	i = 0
	while i < n - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			line[i + 1] = 'B'
			line[i] = 'G'
			i += 2
		else:
			i += 1
for ch in line:
	print(ch, end='')


(n, t) = map(int, input().split())
s = list(input())
s1 = s[:]
for _ in range(t):
	for x in range(n - 1):
		if s[x] == 'B' and s[x + 1] == 'G':
			(s1[x], s1[x + 1]) = (s1[x + 1], s1[x])
	s = s1[:]
print(''.join(s))


arge = input().split(' ')
n = int(arge[0])
t = int(arge[1])
read_queue = input()
queue = []
new_queue = []
for x in read_queue:
	queue.append(x)
	new_queue.append(x)
while t > 0:
	for i in range(n):
		queue[i] = new_queue[i]
	for i in range(1, n):
		if queue[i - 1] == 'B' and queue[i] == 'G':
			new_queue[i - 1] = 'G'
			new_queue[i] = 'B'
	t = t - 1
for x in new_queue:
	print(x, end='')


(a, b) = map(int, input().split())
q = list(input())
i = 0
while b > 0:
	while i < a - 1:
		if q[i + 1] == 'G' and q[i] == 'B':
			q[i + 1] = 'B'
			q[i] = 'G'
			i = i + 2
		else:
			i = i + 1
	b = b - 1
	i = 0
print(''.join(q))


(n, t) = list(map(int, input().split()))
s = input()
l = []
for d in s:
	l.append(d)
for i in range(t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			temp = l[j]
			l[j] = l[j + 1]
			l[j + 1] = temp
			j += 1
		j += 1
output = ''
for d in l:
	output = f'{output}{d}'
print(output)


(n, t) = map(int, input().split())
data = input()
for _ in range(t):
	data = data.replace('BG', 'GB')
print(data)


a = list(map(int, input().split()))
n = a[0]
t = a[1]
initial = list(input())
switch = []
for x in range(1, t + 1):
	for y in range(1, n):
		if initial[y - 1] == 'B' and initial[y] == 'G':
			switch.append(y)
	for d in switch:
		initial[d - 1] = 'G'
		initial[d] = 'B'
	switch = []
print(''.join(initial))


(n, t) = map(int, input().split())
s = input()
z = s
for i in range(t):
	s = z
	for k in range(len(s) - 1):
		if s[k] == 'B' and s[k + 1] == 'G':
			z = z[:k] + 'GB' + z[k + 2:]
print(z)


(number, time) = map(int, input().split())
queue = list(input())
for i in range(time):
	p = 0
	while p < len(queue) - 1:
		if queue[p] == 'B' and queue[p + 1] == 'G':
			queue[p] = 'G'
			queue[p + 1] = 'B'
			p += 2
		else:
			p += 1
print(''.join(queue))


(a, b) = input().split(' ')
a = int(a)
b = int(b)
c = list(input())
for _ in range(b):
	d = False
	i = 0
	while i < a - 1:
		if c[i] == 'B' and c[i + 1] == 'G':
			(c[i], c[i + 1]) = ('G', 'B')
			i += 1
			d = True
		i += 1
	if d == False:
		break
print(''.join(c))


a = input().split()
b = input()
c = int(a[0])
d = []
for i in b:
	d.append(i)
for j in range(int(a[1])):
	i = 0
	while i <= c - 2:
		if d[i] == 'B' and d[i + 1] == 'G':
			d[i] = 'G'
			d[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
for j in d:
	print(j, end='')


s1 = input()
s2 = s1.split()
s2 = [int(x) for x in s2]
s3 = input()
s4 = list(s3)
for i in range(s2[1]):
	j = 0
	while j < s2[0] - 1:
		if s4[j] == 'B' and s4[j + 1] == 'G':
			(s4[j], s4[j + 1]) = (s4[j + 1], s4[j])
			j = j + 1
		j = j + 1
print(''.join(s4))


(a, b) = map(int, input().split())
s = input()
A = [char for char in s]
for i in range(b):
	j = 0
	while j < a - 1:
		if A[j] == 'B' and A[j + 1] == 'G':
			(A[j], A[j + 1]) = (A[j + 1], A[j])
			j += 2
		else:
			j += 1
print(''.join(A))


(a, b) = map(int, input().split())
s = input()
for k in range(0, b):
	s = s.replace('BG', 'GB')
print(s)


k = [int(x) for x in input().split()]
a = list(input())

def swap(a, i):
	temp = a[i]
	a[i] = a[i - 1]
	a[i - 1] = temp
for _ in range(k[1]):
	p = k[0] - 1
	while p >= 0:
		if a[p] == 'G' and a[p - 1] == 'B' and (p - 1 >= 0):
			swap(a, p)
			p -= 2
		else:
			p -= 1
print(''.join(a))


(a, b) = map(int, input().split())
l = input()
l = list(l)
while b > 0:
	num1 = 0
	while num1 < a - 1:
		person1 = l[num1]
		person2 = l[num1 + 1]
		if person2 == 'G' and person1 == 'B':
			l[num1] = 'G'
			l[num1 + 1] = 'B'
			num1 += 1
		num1 += 1
	b -= 1
str1 = ''
for i in l:
	str1 += i
print(str1)


TN = 1

def solution():
	(n, t) = map(int, input().split())
	s = list(input())
	for i in range(t):
		js = []
		for j in range(0, n - 1):
			if s[j] == 'B' and s[j + 1] == 'G':
				js.append(j)
		for k in js:
			(s[k], s[k + 1]) = (s[k + 1], s[k])
	print(''.join(s))
while TN != 0:
	solution()
	TN -= 1


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def array():
	return [int(i) for i in input().split()]
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
s = list(input())
for i in range(k):
	p = 0
	while p < n - 1:
		if s[p] == 'B' and s[p + 1] == 'G':
			(s[p], s[p + 1]) = (s[p + 1], s[p])
			p += 1
		p += 1
print(''.join(s))


(sl, t) = list(map(int, input().split()))
s = input()
l = list(s)
for k in range(t):
	res = []
	for i in range(len(l) - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			res.append(i)
	for p in range(len(res)):
		l[res[p]] = 'G'
		l[res[p] + 1] = 'B'
print(''.join(l))


(a, b) = map(int, input().split())
c = input()
d = []
n = 0
for y in range(a):
	d.append(c[y])
for p in range(b):
	while n < a - 1:
		if d[n] == 'B' and d[n + 1] == 'G':
			d[n] = 'G'
			d[n + 1] = 'B'
			n += 2
		else:
			n += 1
	n = 0
for r in range(a):
	print(d[r], end='')


def answer():
	k = input().split()
	(a, b) = (int(k[0]), int(k[1]))
	l = list(input())
	while b:
		j = 0
		toc = []
		while j < a - 1:
			if l[j] == 'B' and l[j + 1] == 'G':
				toc.append(j)
			j += 1
		j = 0
		while j < len(l):
			if j in toc:
				l[j] = 'G'
				l[j + 1] = 'B'
			j += 1
		b -= 1
	(i, ans) = (0, '')
	while i < len(l):
		ans += l[i]
		i += 1
	return ans
print(answer())


n = int(str(input()).split(' ')[1])
s = input()
for _ in range(n):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
ini = list(input())
for i in range(t):
	j = 0
	while j < len(ini) - 1:
		if ini[j] == 'B' and ini[j + 1] == 'G':
			ini[j] = 'G'
			ini[j + 1] = 'B'
			j = j + 2
		else:
			j = j + 1
out = ''.join(ini)
print(out)


(n, t) = map(int, input().split())
s = input()[:n]
for j in range(t):
	d = 1
	for i in range(0, len(s) - 1):
		if d == 0:
			d = 1
			continue
		elif s[i] == 'B' and s[i + 1] == 'G':
			s = s[0:i] + s[i + 1] + s[i] + s[i + 2:]
			d = 0
print(s)


(a, b) = map(int, input().split())
fila = input()
for c in range(b):
	fila = fila.replace('BG', 'GB')
print(fila)


(n, t) = map(int, input().split())
s = input()
for p in range(t):
	s1 = ''
	i = 0
	while i < n - 1:
		if s[i] != 'B':
			s1 += s[i]
		elif s[i + 1] == 'G':
			s1 += 'G'
			s1 += 'B'
			i += 1
		else:
			s1 += 'B'
		i += 1
	if s[n - 1] == 'B':
		s1 += 'B'
	if s[n - 1] == 'G' and s[n - 2] != 'B':
		s1 += 'G'
	s = s1
print(s)


(student, times) = [int(i) for i in input().split()]
Line = list(input())
for j in range(0, times):
	i = 0
	while i < student - 1:
		if Line[i] == 'B' and Line[i + 1] == 'G':
			(Line[i], Line[i + 1]) = (Line[i + 1], Line[i])
			i += 1
		i += 1
for i in Line:
	print(i, end='')


(a, b) = [int(x) for x in input().split()]
c = input()
for i in range(0, b):
	if 'BG' in c:
		c = c.replace('BG', 'GB')
print(c)


(n, t) = map(int, input().split())
s = list(str(input()))
while t:
	m = 0
	while m < n - 1:
		if s[m] == 'B' and s[m + 1] == 'G':
			(a, b) = (m, m + 1)
			(s[a], s[b]) = (s[b], s[a])
			m += 2
		else:
			m += 1
	t -= 1
print(''.join(s))


(n, p) = map(int, input().split(' '))
i = 0
j = 0
c = []
q = str(input())
for l in q:
	c += l
for i in range(p):
	j = 0
	while j < n - 1:
		if c[j] == 'B' and c[j + 1] == 'G':
			c[j] = 'G'
			c[j + 1] = 'B'
			j = j + 2
		else:
			j += 1
print(''.join(c))


(n, t) = map(int, input().split())
queue = input()
arr = []
for i in range(n):
	arr.append(queue[i])

def shift():
	indices = []
	for i in range(n - 1):
		if arr[i] == 'B' and arr[i + 1] == 'G':
			indices.append(i)
	for i in indices:
		(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
for i in range(t):
	shift()
result = ''
for i in arr:
	result += i
print(result)


(n, t) = map(int, input().split())
w = input()
if n == 1:
	print(w)
else:
	for i in range(0, t):
		w = w.replace('BG', 'GB')
	print(w)


(n, t) = map(int, input().split())
s = list(input())
w = []
for i in range(n):
	if s[i] == 'B':
		w.append(i)
for j in range(t):
	for k in range(len(w)):
		if w[k] < n - 1 and s[w[k] + 1] == 'G':
			s[w[k]] = 'G'
			s[w[k] + 1] = 'B'
			w[k] += 1
print(*s, sep='')


i = list(input().split(' '))
number = int(i[0])
time = int(i[1])
m = 0
p = [i for i in input()]
for t in range(0, time):
	for i in range(0, number):
		if m < number - 1:
			if p[m] == 'B' and p[m + 1] == 'G':
				p[m] = 'G'
				p[m + 1] = 'B'
				m += 2
			else:
				m += 1
	m = 0
m = ''.join(p)
print(m)


(a, b) = map(int, input().split())
li = list(input())
lii = list(li)
if b == 1:
	for j in range(a - 1):
		if li[j] == 'B' and li[j + 1] == 'G':
			(lii[j], lii[j + 1]) = (lii[j + 1], lii[j])
else:
	for i in range(b):
		for j in range(a - 1):
			if li[j] == 'B' and li[j + 1] == 'G':
				(lii[j], lii[j + 1]) = (lii[j + 1], lii[j])
		li = list(lii)
l = ''.join(lii)
print(l)


(n, t) = list(map(int, input().split()))
s = input()
sL = []
ind = []
for j in range(t):
	for i in range(n - 1):
		if s[i] == 'B':
			if s[i + 1] == 'G':
				ind.append(i)
			else:
				sL.append(s[i])
		else:
			sL.append(s[i])
	sL.append(s[n - 1])
	for k in range(len(ind)):
		sL.insert(ind[k] + 1, 'B')
	s = ''.join(sL)
	sL = []
	ind = []
print(s)


(n, t) = (int(i) for i in input().split(' '))
s = [i for i in input()]
k = s[:]
for i in range(t):
	s = k[:]
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			k[i] = 'G'
			k[i + 1] = 'B'
print(''.join((str(i) for i in k)))


(n, t) = map(int, input().split())
queue = input()
for _ in range(t):
	if 'BG' in queue:
		queue = queue.replace('BG', 'GB')
print(queue)


def k(p, a):
	if p == 0:
		return a
	else:
		return k(p - 1, a.replace('BG', 'GB'))
print(k(int(input().split()[1]), input()))


(n, t) = [int(x) for x in input().split()]
a = [c for c in input()]
for _ in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 2
		else:
			i += 1
print(''.join(a))


(x, y) = map(int, input().split())
s = input()
for i in range(y):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
k = input()
for i in range(t):
	k = k.replace('BG', 'GB')
print(''.join(k))


(n, t) = [int(x) for x in input().split()]
a = input()
queue = [x for x in a]
new = queue[:]
for i in range(t):
	for j in range(n - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			new[j] = 'G'
			new[j + 1] = 'B'
	queue = new[:]
print(''.join(queue))


(n, t) = [int(elem) for elem in input().split()]
s = input()
key = False
for i in range(t):
	buff = ''
	j = 0
	while j < len(s):
		if j != len(s) - 1:
			if s[j] == 'B' and s[j + 1] == 'G':
				buff += 'GB'
				j += 2
			else:
				buff += s[j]
				j += 1
		else:
			buff += s[j]
			j += 1
	s = buff
print(s)


[n, t] = [int(x) for x in input().split(' ')]
seq = input()
for _ in range(t):
	newSeq = list(seq)
	for i in range(n):
		if i > 0 and seq[i - 1] == 'B' and (seq[i] == 'G'):
			newSeq[i - 1] = 'G'
			newSeq[i] = 'B'
	seq = ''.join(newSeq)
print(seq)


(n, t) = list(map(int, input().rstrip().split()))
k = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if k[j] == 'B' and k[j + 1] == 'G':
			k[j] = 'G'
			k[j + 1] = 'B'
			j = j + 1
		j = j + 1
for l in range(n):
	print(k[l], end='')


(n, t) = map(int, input().split())
string = list(input())
flag = 0
count = 0
for j in range(t):
	flag = 0
	for i in range(0, n - 1):
		if flag == 1:
			flag = 0
			continue
		if string[i] == 'B' and string[i + 1] == 'G':
			(string[i + 1], string[i]) = (string[i], string[i + 1])
			flag = 1
for c in string:
	print(c, end='')


(n, t) = map(int, input().split())
arr = [a for a in input()]
while t != 0:
	x = 0
	while x < n - 1:
		if arr[x] == 'B' and arr[x + 1] == 'G':
			(arr[x], arr[x + 1]) = (arr[x + 1], arr[x])
			x += 1
		x += 1
	t -= 1
ans = ''
for x in arr:
	ans += x
print(ans)


(n, t) = map(int, input().strip().split())
list1 = input()
list2 = list(list1)
for i in range(t):
	j = 1
	while j < n:
		if list2[j] == 'G' and list2[j - 1] == 'B':
			(list2[j], list2[j - 1]) = (list2[j - 1], list2[j])
			j = j + 2
		else:
			j = j + 1
list2 = ''.join(list2)
print(list2)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, t) = get_ints()
string = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if string[j] == 'B' and string[j + 1] == 'G':
			(string[j], string[j + 1]) = ('G', 'B')
			j += 2
		else:
			j += 1
print(''.join(string))


n = input().split()
n = list(map(int, n))
k = int(n[1])
s = input()
while k:
	s = s.replace('BG', 'GB')
	k -= 1
print(s)


num = input()
queue = input()
arr = []
count = 0
for i in range(0, len(num)):
	if num[i] == ' ':
		arr.append(int(num[count:i]))
		count = i + 1
	elif i == len(num) - 1:
		arr.append(int(num[count:len(num)]))
j = 0
while j < arr[1]:
	check = [False] * len(queue)
	for i in range(0, len(queue) - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			if check[i] == False:
				queue = queue[0:i] + 'G' + queue[i + 1:len(queue)]
				queue = queue[0:i + 1] + 'B' + queue[i + 2:len(queue)]
				check[i + 1] = True
	j += 1
print(queue)


(n, time) = map(int, input().split())
line = input()
for t in range(time):
	q = 0
	while q < len(line):
		incremented = True
		if q + 1 < len(line):
			if line[q] == 'B' and line[q + 1] == 'G':
				if q + 2 < len(line):
					line = line[:q] + 'GB' + line[q + 2:]
					q += 2
					incremented = False
				else:
					line = line[:q] + 'GB'
		if incremented:
			q += 1
print(line)


def main():
	line = input().split()
	n = int(line[0])
	time = int(line[1])
	people = list(input())
	for i in range(time):
		j = 0
		while j < n - 1:
			if people[j] == 'B' and people[j + 1] == 'G':
				(people[j], people[j + 1]) = (people[j + 1], people[j])
				j = j + 1 + 1
			else:
				j = j + 1
	s = ''
	for i in range(n):
		s += people[i]
	print(s)
main()


(length, times) = map(int, input().split())
arrangement = input()
lis = list(arrangement)
for i in range(times):
	for j in range(len(arrangement) - 1):
		if arrangement[j] == 'B' and arrangement[j + 1] == 'G':
			lis[j] = 'G'
			lis[j + 1] = 'B'
	arrangement = ''.join(lis)
print(arrangement)


(_, t) = map(int, input().split())
s = list(input())
b = 'B'
g = 'G'

def f(arr):
	skip = [0] * len(arr)
	for i in range(len(arr) - 1):
		if arr[i] == b and (not skip[i]):
			if arr[i + 1] == g:
				(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
				skip[i + 1] = 1
for i in range(t):
	f(s)
print(''.join(s))


import sys
(n, t) = map(int, sys.stdin.readline().split())
s = input()
queue = []
while t and 'BG' in s:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


(n, t) = map(int, input().split())
queue = list(input())
exchange = []
for i in range(0, t):
	for j in range(0, n - 1):
		if ord(queue[j]) < ord(queue[j + 1]):
			exchange.append(j)
	for k in exchange:
		(queue[k], queue[k + 1]) = (queue[k + 1], queue[k])
	exchange.clear()
print(''.join(queue))


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
(n, m) = zz()
l = list(z())
for _ in range(m):
	i = 0
	for _ in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 2
			i = min(n - 2, i)
		else:
			i += 1
		if i >= n - 1:
			break
print(''.join((str(i) for i in l)))


from sys import stdin
i = [x.rstrip() for x in stdin.readlines()]
it = int(i[0].split()[1])
q = [c for c in i[1]]
l = len(q)
steps = l * it
x = 0
while x < steps:
	if q[x % l] == 'B' and q[(x + 1) % l] == 'G':
		(q[x % l], q[(x + 1) % l]) = ('G', 'B')
		x += 1
	x += 1
	if not (x + 1) % l:
		x += 1
print(''.join(q))


(n, t) = map(int, input().split())
string = input()
while t:
	idx = 1
	while idx < n:
		if string[idx] == 'G' and string[idx - 1] == 'B':
			string = string[:idx - 1] + string[idx:idx + 1] + string[idx - 1:idx] + string[idx + 1:]
			idx += 1
		idx += 1
	t -= 1
print(string)


(n, t) = map(int, input().split())
queue = input()
if 'B' not in queue or 'G' not in queue:
	print(queue)
else:
	for i in range(t):
		queue = queue.replace('BG', 'GB')
	print(queue)


def parse():
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	s = input()
	list_ = [ch for ch in s]
	return (n, k, list_)

def process(n, k, list_):
	while k:
		i = 0
		while i < n - 1:
			if list_[i] == 'B' and list_[i + 1] == 'G':
				(list_[i], list_[i + 1]) = (list_[i + 1], list_[i])
				i += 1
			i += 1
		k -= 1
	return ''.join(list_)

def main():
	print(process(*parse()))
main()


(n, t) = [int(x) for x in input().split()]
s = input()
l = list(s)
for i in range(t):
	j = 0
	while j < n - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = ('G', 'B')
			j += 1
		j += 1
a = ''
for i in range(n):
	a += l[i]
print(a)


(n, t) = tuple(map(int, input().split()))
Queue = input()
for _ in range(t):
	B_idx = [i for i in range(len(Queue)) if Queue[i] == 'B' and i != len(Queue) - 1]
	for idx in B_idx:
		if Queue[idx] == 'B' and Queue[idx + 1] == 'G':
			if idx < len(Queue) - 2:
				Queue = Queue[:idx] + 'GB' + Queue[idx + 2:]
			else:
				Queue = Queue[:idx] + 'GB'
print(Queue)


(n, s) = (int(i) for i in input().split())
data = [s for s in input()]
data1 = data[:]
for i in range(s):
	for j in range(n - 1):
		if data[j] == 'B' and data[j + 1] == 'G':
			(data1[j], data1[j + 1]) = (data1[j + 1], data1[j])
	data = data1[:]
print(''.join((str(s) for s in data)))


c = 0
(a, b) = [int(x) for x in input().split()]
lis_i = list(input())
lis_j = lis_i
for i in range(b):
	for j in lis_i:
		c += 1
		if c == 1:
			d = j
		elif d < j:
			lis_j[c - 2] = j
			lis_j[c - 1] = d
		d = j
	c = 0
	lis_i = lis_j
print(''.join(lis_i))


(m, n) = map(int, input().split())
qu = input()
x = 0
while x < n:
	qu = qu.replace('BG', 'GB')
	x = x + 1
print(qu)


(n, t) = map(int, input().split(' '))
ocher = input()
out = ''
flag = False
for i in range(t):
	cou = 0
	while cou < n:
		if cou < n - 1 and ocher[cou] == 'B' and (ocher[cou + 1] == 'G'):
			cou += 2
			out = out + 'G' + 'B'
		else:
			out = out + ocher[cou]
			cou += 1
	ocher = out
	out = ''
print(ocher)


(n, t) = map(int, input().split())
check = False
(lst, lst_2) = ([i for i in input()], [])
for _ in range(t):
	for i in range(n - 1, 0, -1):
		if lst[i] == 'G' and i != 0 and (i not in lst_2):
			if lst[i - 1] == 'B':
				(lst[i], lst[i - 1]) = ('B', 'G')
				(lst_2.append(i), lst_2.append(i - 1))
				check = True
		(lst_2.append(i), lst_2.append(i - 1) if lst[i - 2] != 'B' and i - 2 > 0 and (not check) else lst_2.append(i))
		check = False
	lst_2 = []
print(''.join(lst))


(n, t) = map(int, input().split())
s = list(input())
while t != 0:
	i = 0
	while i < n:
		if s[i] == 'B' and i < len(s) - 1:
			if s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				i += 1
		i = i + 1
	t = t - 1
new = ''.join(s)
print(new)


(n, t) = [int(__) for __ in input().strip().split()]
arr = list(input().strip())
while t > 0:
	i = 0
	while i < len(arr) - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			arr[i] = 'G'
			arr[i + 1] = 'B'
			i += 1
		i += 1
	t -= 1
print(''.join(arr))


a = input()
a = a.split(' ')
a = list(map(int, a))
n = a[0]
t = a[1]
queue = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			queue[j] = 'G'
			queue[j + 1] = 'B'
			j += 1
		j += 1
q = ''
for i in range(n):
	q = q + queue[i]
print(q)


thing = list(map(int, input().split()))
num = thing[1]
le = thing[0]
line = list(input())
if le == 0:
	print('')
else:
	while num != 0:
		i = 1
		while i < len(line):
			if line[i - 1] == 'B' and line[i] == 'G':
				line[i - 1] = 'G'
				line[i] = 'B'
				i = i + 1
			i = i + 1
		num = num - 1
	print(''.join(line))


(people, time) = map(int, input().split())
queue = input()
count = 0
while count < time:
	queue = queue.replace('BG', 'GB')
	count += 1
print(queue)


(a, b) = map(int, input().split())
s = input()
for _ in range(b):
	if 'BG' in s:
		s = s.replace('BG', 'GB')
print(s)


(n, t) = [int(j) for j in input().split()]
Q = input()
for j in range(t):
	i = 0
	while i < n:
		if Q[i:i + 2] == 'BG':
			Q = Q[:i] + 'GB' + Q[i + 2:]
			i += 1
		i += 1
print(Q)


t = int(input().split()[1])
q = input()
for i in range(0, t):
	q = q.replace('BG', 'GB')
print(q)


import copy
lt = input()
l = int(lt.split(' ')[0])
t = int(lt.split(' ')[1])
q = input()
q = [char for char in q]
q_c = copy.deepcopy(q)
for i in range(t):
	for j in range(1, l):
		if q[j] == 'G' and q[j - 1] == 'B':
			q_c[j] = 'B'
			q_c[j - 1] = 'G'
	q = copy.deepcopy(q_c)
ans = ''
for i in range(l):
	ans = ans + q[i]
print(ans)


(n, t) = map(int, input().split())
x = input().strip()
for i in range(t):
	x = x.replace('BG', 'GB')
print(x)


(q_length, times) = list(map(int, input().split()))
q_order = input()
for _ in range(times):
	behind = 'G'
	x = 0
	for i in q_order:
		if i == 'G' and behind == 'B':
			q_order = q_order[:x - 1] + q_order[x] + q_order[x - 1] + q_order[x + 1:]
		behind = i
		x += 1
print(q_order)


(n, m) = map(int, input().split())
lst = list(input())
for i in range(m):
	j = -1
	while j < n - 2:
		j += 1
		if lst[j] == 'B' and lst[j + 1] == 'G':
			(lst[j], lst[j + 1]) = (lst[j + 1], lst[j])
			j += 1
print(''.join(lst))


(n, t) = map(int, input().split())
a = input()
for i in range(t):
	z = ['0'] * len(a)
	for i in range(n - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			z[i] = 'G'
			z[i + 1] = 'B'
		elif z[i] == '0':
			z[i] = a[i]
	if z[n - 1] == '0':
		z[n - 1] = a[n - 1]
	a = ''.join(z)
print(a)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	s1 = []
	s1.append(s[0])
	for i in range(1, n):
		if s[i] == 'G' and s[i - 1] == 'B':
			s1.pop()
			s1.append('G')
			s1.append('B')
		else:
			s1.append(s[i])
	s = s1.copy()
for i in s:
	print(str(i), end='')


from sys import stdin
(n, t) = (int(x) for x in stdin.readline().strip().split(' '))
order = list(stdin.readline().strip())
for _ in range(t):
	person = 1
	while person < n:
		if order[person - 1] == 'B' and order[person] == 'G':
			(order[person - 1], order[person]) = (order[person], order[person - 1])
			person += 1
		person += 1
print(''.join(order))


n = int(input().split()[1])
s = list(input())
k = True
for j in range(n):
	if not k:
		break
	k = False
	i = 1
	while i in range(1, len(s)):
		if s[i] == 'G' and s[i - 1] == 'B':
			k = True
			(s[i], s[i - 1]) = ('B', 'G')
			i += 1
		i += 1
print(*s, sep='')


(n, t) = input().split(' ')
n = int(n)
t = int(t)
s = str(input())
q = [s[x] for x in range(len(s))]
i = 0
while t > 0:
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			i += 1
		i += 1
	t -= 1
a = ''
for k in range(len(q)):
	a += q[k]
print(a)


(n, t) = [int(x) for x in input().split()]
line = input()
for i in range(t):
	if 'BG' in line:
		line = line.replace('BG', 'GB')
print(line)


from itertools import tee

def pairwise(iterable):
	(a, b) = tee(iterable)
	next(b, None)
	return zip(a, b, range(n))
(n, t) = [int(x) for x in input('').split()]
children = list(input(''))
for _ in range(t):
	for (a, b, i) in pairwise(children):
		if a == 'B' and b == 'G':
			(children[i], children[i + 1]) = (children[i + 1], children[i])
print(''.join(children))


s = input().split(' ')
a = int(s[0])
b = int(s[1])
s1 = list(input())
for i in range(b):
	tmpsa = s1.copy()
	for j in range(a - 1):
		if s1[j] == 'B' and s1[j + 1] == 'G':
			tmpsa[j] = 'G'
			tmpsa[j + 1] = 'B'
	s1 = tmpsa
print(''.join(s1))


(n, t) = map(int, input().split())
string = input()
flag = 0
new_string = ''
for a in range(t):
	for i in range(n):
		if flag == 1:
			flag = 0
			continue
		if string[i] == 'G':
			new_string = new_string + 'G'
		elif i + 1 == n:
			new_string = new_string + string[i]
		elif string[i + 1] == 'B':
			new_string = new_string + 'B'
		else:
			new_string = new_string + 'GB'
			flag = 1
	string = new_string
	new_string = ''
print(string)


(k0, k1) = map(int, input().split())
a = list(input())
for j in range(k1):
	m = 0
	while m < k0 - 1:
		if a[m] == 'B' and a[m + 1] == 'G':
			k = a[m]
			a[m] = a[m + 1]
			a[m + 1] = k
			m += 2
		else:
			m += 1
print(''.join(a))


(n, t) = map(int, input().split())
s = [k for k in input()]
d = s
for k in range(t):
	j = 1
	while j < n:
		if d[j] == 'G' and d[j - 1] == 'B':
			d[j] = 'B'
			d[j - 1] = 'G'
			j += 2
		else:
			j += 1
	s = d
print(''.join(s))


(n, t) = (int(i) for i in input().split())
l = list(input())
while t > 0:
	c = 0
	i = 0
	while i <= n - 2:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			c += 1
			i += 2
		else:
			i += 1
	t -= 1
	if c == 0:
		break
print(''.join(l))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(num, t) = invr()
string = insr()
for j in range(t):
	i = 0
	while i < num - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			string[i] = 'G'
			string[i + 1] = 'B'
			i += 2
		else:
			i += 1
sys.stdout.write(''.join(string))


lis = list(map(int, input().split()))
st = list(input())
for j in range(lis[1]):
	i = 0
	while i < lis[0] - 1:
		if st[i] == 'B' and st[i + 1] == 'G':
			(st[i], st[i + 1]) = (st[i + 1], st[i])
			i += 2
		else:
			i += 1
stc = ''.join(st)
print(stc)


(n, t) = map(int, input().split())
a = input()
s = list(a)
l = len(s)
while t > 0:
	i = 0
	t -= 1
	while i < l - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i = i + 1
		i += 1
print(''.join((i for i in s)))


import sys
input = sys.stdin.readline

def main():
	(n, t) = map(int, input().split())
	s = list(input().strip())
	for _ in range(t):
		flg = False
		for i in range(n - 1):
			if flg:
				flg = False
			elif s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				flg = True
	print(''.join(s))
main()


import sys
try:
	sys.stdin = open(sys.path[0] + '\\input.txt', 'r')
	sys.stdout = open(sys.path[0] + '\\output.txt', 'w')
except Exception as e:
	pass
(n, t) = list(map(int, input().split()))
s = list(input())
for j 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
		else:
			i += 1
print(*s, sep='')


def queueAtSchool(queue, interation):
	qLen = len(queue)
	for j in range(0, interation):
		i = 0
		while i < qLen:
			if i != qLen - 1 and queue[i] == 'B' and (queue[i + 1] == 'G'):
				queue[i] = 'G'
				queue[i + 1] = 'B'
				i += 2
			else:
				i += 1
	return ''.join(queue)
(n, t) = map(int, input().split())
queue = [x for x in input()]
print(queueAtSchool(queue, t))


nt = input().split()
n = int(nt[0])
t = int(nt[1])
line = input()
row = []
for x in line:
	row.append(x)
last_row = row
for i in range(t):
	line = ''.join(row)
	for (i, c) in enumerate(line):
		if i < len(last_row) - 1:
			if c == 'B' and last_row[i + 1] == 'G':
				row[i] = 'G'
				row[i + 1] = 'B'
print(''.join(row))


(N, T) = map(int, input().strip().split(' '))
s = list(input())
str = ''
while T > 0:
	i = N - 1
	while i > 0:
		if s[i] == 'G':
			if s[i - 1] == 'B':
				temp = s[i - 1]
				s[i - 1] = s[i]
				s[i] = temp
				i -= 2
				continue
		i -= 1
	T -= 1
print(str.join(s))


(n, t) = list(map(int, input().split()))
S = input().upper()
queue = []
for x in S:
	queue.append(x)
index = []

def queuemanager(index):
	i = 0
	while i < n:
		if i != n - 1:
			if queue[i] != queue[i + 1]:
				if queue[i] == 'B':
					index.append(i)
					i += 1
				else:
					i += 1
					continue
			else:
				i += 1
				continue
		else:
			break
	j = 0
	while j < len(index):
		a = index[j]
		x = queue[a]
		y = queue[a + 1]
		queue[a + 1] = x
		queue[a] = y
		j += 1
	index.clear()
k = 0
while k < t:
	queuemanager(index)
	k += 1
l = 0
while l < len(queue):
	print(queue[l], end='')
	l += 1


def solve(lst, t):
	old_lst = lst
	for i in range(t):
		swaps = []
		for (i, kid) in enumerate(old_lst):
			if i > 0:
				if kid == 'G' and old_lst[i - 1] == 'B':
					swaps.append((i, i - 1))
		for (i, j) in swaps:
			temp = old_lst[i]
			old_lst[i] = old_lst[j]
			old_lst[j] = temp
	return ''.join(old_lst)
(n, t) = list(map(int, input().rstrip().split()))
lst = list(input())
res = solve(lst, t)
print(res)


(n, t) = map(int, input().split())
st = list(input())
for i in range(t):
	count = 0
	for j in range(n - 1):
		if st[count] == 'B' and st[count + 1] == 'G':
			(st[count], st[count + 1]) = (st[count + 1], st[count])
			count += 2
		else:
			count += 1
		if count >= n - 1:
			break
print(''.join(st))


(n, i) = [int(x) for x in input().split()]
queue = list(input())
if n != 1:
	for loop in range(i):
		id = 0
		while True:
			if queue[id] == 'B' and queue[id + 1] == 'G':
				queue[id] = 'G'
				queue[id + 1] = 'B'
				id += 1
			if id >= n - 2:
				break
			id += 1
print(''.join(queue))


import re
(a, b) = map(int, input().split())
s = input()
while b:
	s = re.sub('BG', 'GB', s)
	b -= 1
print(s)


a = [int(x) for x in input().split()]
s = [x for x in input()]
n = a[0]
t = a[1]
s1 = [x for x in s]
for i in range(t):
	for m in range(1, len(s)):
		if s[m] == 'G' and s[m - 1] == 'B':
			s1[m] = 'B'
			s1[m - 1] = 'G'
	s = [x for x in s1]
a = ''
for i in range(len(s)):
	a = a + s[i]
print(a)


(n, t) = input().split()
(n, t) = [int(n), int(t)]
str1 = ''
if n >= 1:
	m = input()
	lst = list(m)
	for i in range(t):
		m = 0
		while m != n - 1:
			if m > n - 1:
				break
			if lst[m] is 'B' and lst[m + 1] is 'G':
				(lst[m], lst[m + 1]) = (lst[m + 1], lst[m])
				m = m + 2
			else:
				m += 1
	print(str1.join(lst))


n = [int(x) for x in input().split()]
s = str(input())
i = 0
for i in range(n[1]):
	i = 0
	s1 = str()
	while i != n[0]:
		if i + 1 == n[0]:
			s1 = s1 + s[i]
			break
		if s[i] == 'B' and s[i + 1] == 'G':
			s1 = s1 + 'G' + 'B'
			i = i + 2
		else:
			s1 = s1 + s[i]
			i += 1
	s = s1
print(s1)


args = input()
queue = list(input())
(length, iterations) = map(int, args.split())
for iteration in range(iterations):
	prev_item = queue[0]
	for i in range(1, len(queue)):
		curr_item = queue[i]
		if curr_item == 'G' and prev_item == 'B':
			queue[i - 1] = curr_item
			queue[i] = prev_item
		prev_item = curr_item
print(''.join(queue))


(n, t) = list(map(int, input().split(' ')))
s = list(input())
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 += 1
		i += 1
for i in s:
	print(i, end='')


(n, t) = map(int, input().split())
queue = list(input())
temp = list(queue)
for j in range(t):
	for i in range(n - 1):
		if queue[i] == 'B':
			if queue[i + 1] == 'G':
				(temp[i], temp[i + 1]) = (temp[i + 1], temp[i])
	queue = list(temp)
print(''.join(queue))


ha = tuple(map(int, input().split()))
line = input()
for i in range(ha[1]):
	line = line.replace('BG', 'GB')
print(line)


(n, t) = tuple(map(int, input().split()))
s = input()
lb = []
lg = []
for (i, j) in enumerate(list(s)):
	if j == 'B':
		lb.append(i)
	elif j == 'G':
		lg.append(i)

def convert(lb, lg):
	for i in range(len(lb)):
		if lb[i] + 1 in lg:
			lg[lg.index(lb[i] + 1)] -= 1
			lb[i] += 1
	return (lb, lg)
for i in range(t):
	(lb, lg) = convert(lb, lg)
l1 = []
for i in lb:
	l1.insert(i, 'B')
for i in lg:
	l1.insert(i, 'G')
s2 = ''
for i in l1:
	s2 += i
print(s2)


(n, t) = map(int, input().split())
s = input()
c = 0
while t > 0:
	if 'BG' in s:
		s = s.replace('BG', 'GB')
		t = t - 1
	else:
		break
print(s)


(l, n) = map(int, input().split())
l = []
l.append(input())
for _ in range(n):
	l.append(l[-1].replace('BG', 'GB'))
print(l[-1])


(n, t) = map(int, input().split())
queue = list(input())

def rearrange(queue):
	pos = 0
	while pos < len(queue) - 1:
		if queue[pos] == 'B' and queue[pos + 1] == 'G':
			(queue[pos], queue[pos + 1]) = (queue[pos + 1], queue[pos])
			pos += 2
		else:
			pos += 1
	return queue
for i in range(t):
	rearrange(queue)
print(''.join(queue))


(n, t) = map(int, input().split())
d = input()
for i in range(t):
	if 'BG' in d:
		d = d.replace('BG', 'GB')
print(d)


(n, t) = [int(i) for i in input().split()]
s = list(str(input()))
alert = 0
for j in range(t):
	alert = 0
	for i in range(n - 1):
		if alert == 1:
			alert = 0
			continue
		if (s[i], s[i + 1]) == ('B', 'G'):
			(s[i], s[i + 1]) = ['G', 'B']
			alert = 1
print(''.join(s))


inp_lst = [int(x) for x in input().split()]
t = inp_lst[1]
position = list(input())
temp = 0
for i in range(t):
	while temp <= len(position) - 1:
		if temp + 1 > len(position) - 1:
			break
		if position[temp] == 'B' and position[temp + 1] == 'G':
			position[temp] = 'G'
			position[temp + 1] = 'B'
			temp += 2
		else:
			temp += 1
	temp = 0
print(''.join(position))


(a, b) = map(int, input().split())
c = list(input())
while b > 0:
	t = []
	for i in range(a - 1):
		if c[i] == 'B':
			t.append(i)
	for j in t:
		(c[j], c[j + 1]) = (c[j + 1], c[j])
	b -= 1
print(''.join(c))


(n, t) = map(int, input().split())
queue = list(input())
extra = list(queue)

def swap(mentlist, first, last):
	temp = mentlist[first]
	mentlist[first] = mentlist[last]
	mentlist[last] = temp
	return mentlist
for i in range(0, t):
	for j in range(len(queue) - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			extra = swap(extra, j, j + 1)
	queue = list(extra)
finalans = ''.join(extra)
print(finalans)


(n, t) = map(int, input().split(' '))
s = list(input())
assert n == len(s)
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 += 1
		i += 1
print(''.join(s))


(n, t) = tuple(map(int, input().split()))
children = input()
for i in range(t):
	prev = children[0]
	for i in range(len(children))[1:]:
		if prev == 'B' and children[i] == 'G':
			prev = 'X'
			children = children[:i - 1] + 'GB' + children[i + 1:]
		else:
			prev = children[i]
print(children)


(n, x) = input().split()
x = int(x)
n = int(n)
s = input()
l = list(s)
for y in range(x):
	k = 0
	while k < n - 1:
		if l[k] == 'B' and l[k + 1] == 'G':
			(l[k], l[k + 1]) = (l[k + 1], l[k])
			k += 1
		k += 1
print(''.join(l))


(length, time) = list(map(int, input().split()))
from collections import deque
arr = deque(input())
for _ in range(time):
	i = 0
	while i < length - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			arr[i] = 'G'
			arr[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(arr))


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s = s[0:i] + 'G' + 'B' + s[i + 2:]
			i += 2
			continue
		i += 1
print(s)


(total, tiempo_f) = [int(x) for x in input().strip().split(' ')]
fila = input()
for e in range(tiempo_f):
	new_fila = ''
	actual = 0
	while actual < total:
		if actual + 1 < total and fila[actual] == 'B' and (fila[actual + 1] == 'G'):
			new_fila += 'GB'
			actual += 2
		else:
			new_fila += fila[actual]
			actual += 1
	fila = new_fila
print(fila)


(N, K) = map(int, input().split())
l = [i for i in input()]
for i in range(K):
	indexes = [i for i in range(N - 1) if l[i] == 'B' and l[i + 1] == 'G']
	for index in indexes:
		start = index + 1
		(l[start], l[index]) = (l[index], l[start])
print(''.join(l))


(n, t) = [int(x) for x in input().split()]
queue = input()
s = []
for i in range(n):
	s.append(queue[i])
for i in range(t):
	skip = -1
	for k in range(n - 1):
		if s[k] == 'B' and s[k + 1] == 'G' and (skip != k):
			s[k + 1] = 'B'
			s[k] = 'G'
			skip = k + 1
for i in range(n):
	print(s[i], end='')


(n, t) = input().split()
intt = int
queue = input()
queue = list(queue)
for _ in range(intt(t)):
	i = 0
	while i < intt(n) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
string = input()
lis = list(string)
j = 0
k = [[0 for x in range(n)] for y in range(t)]
if len(string) != n:
	print('data error!！')
else:
	while j < t:
		for i in range(n - 1):
			if k[j][i] == 1:
				continue
			if lis[i] != lis[i + 1] and lis[i] == 'B':
				tmp = lis[i]
				lis[i] = lis[i + 1]
				lis[i + 1] = tmp
				k[j][i + 1] = 1
		j += 1
print(''.join(lis))


inp1 = str(input())
inp = inp1.split()
n = int(inp[0])
t = int(inp[1])
s1 = str(input())
s = []
for i in range(n):
	s.append(s1[i])
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] != s[j + 1] and s[j] == 'B':
			temp = ''
			temp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = temp
			j += 2
		else:
			j += 1
for i in range(n):
	print(s[i], end='')


(n, t) = map(int, input().split())
queue = input()
b = [char for char in queue]
while t > 0:
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 1
		i += 1
	t -= 1
print(''.join(b))


t = int(input().split()[1])
s = input()
for _ in ' ' * t:
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
order = str(input())
order = list(order)
for _ in range(0, t):
	start = 0
	while start < n - 1:
		if order[start] == 'B' and order[start + 1] == 'G':
			(order[start], order[start + 1]) = (order[start + 1], order[start])
			start = start + 2
		else:
			start = start + 1
print(''.join(order))


def main():
	(n, t) = map(lambda x: int(x), input().split())
	s = input()
	for _ in range(t):
		s = s.replace('BG', 'GB')
	return s
print(main())


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
(x, y) = ml()
n = list(ip())
i = 0
while i < y:
	i += 1
	j = 1
	while j < x:
		if n[j - 1] == 'B' and n[j] == 'G':
			(n[j], n[j - 1]) = (n[j - 1], n[j])
			j += 1
		j += 1
print(''.join(n))


(n, t) = map(int, input().split())
k = input()
for x in range(t):
	k = k.replace('BG', 'GB')
print(k)


(n, time) = map(int, input().split())
l = input()
s = []
for i in range(0, n):
	s.append(l[i])
while time > 0:
	t = s.copy()
	for i in range(0, n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			t[i] = 'G'
			t[i + 1] = 'B'
	s = t
	time -= 1
u = ''
for i in s:
	u += i
print(u)


(n, t) = map(int, input().split())
s = input()
while t:
	if 'BG' in s:
		s = s.replace('BG', 'GB')
	t = t - 1
print(s)


q = input().split(' ')
a = int(q[0])
b = int(q[1])
w = input()
while b:
	w = w.replace('BG', 'GB')
	b = b - 1
print(w)


(n, t) = map(int, input().split())
str = list(input())
l = len(str)
for i in range(0, t, 1):
	for j in range(0, l - 1, 1):
		if str[j] == 'B' and str[j + 1] == 'G':
			str[j] = 'G'
			str[j + 1] = 'C'
		elif str[j] == 'C':
			str[j] = 'B'
	if str[l - 1] == 'C':
		str[l - 1] = 'B'
for i in str:
	print(i, end='')
print


(n, t) = map(int, input().split())
c = input()
Q = []
for i in range(n):
	Q.append(c[i])
for i in range(t):
	j = 0
	while j < n - 1:
		if Q[j] == 'B' and Q[j + 1] == 'G':
			(Q[j], Q[j + 1]) = ('G', 'B')
			j += 1
		j += 1
for i in Q:
	print(i, sep='', end='')


(n, k) = map(int, input().split())
s = input()
l = []
for i in range(n):
	l.append(s[i])
while k > 0:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i = i + 1
		i += 1
	k -= 1
s2 = ''
for i in l:
	s2 = s2 + i
print(s2)


(n, t) = input().split()
n = int(n)
t = int(t)
word = input()
for i in range(t):
	m = 0
	while m < n - 1:
		if word[m] == 'B' and word[m + 1] == 'G':
			word = word[:m] + 'GB' + word[m + 2:]
			m = m + 2
		else:
			m = m + 1
print(word)


(a, b) = input().split()
(a, b) = (int(a), int(b))
lst = list(input())
lst1 = lst[0:a]
for t in range(b):
	for i in range(a - 1):
		if lst[i] == 'B' and lst[i + 1] == 'G':
			lst1[i] = lst[i + 1]
			lst1[i + 1] = lst[i]
	lst = lst1[0:a]
d = ''
s = d.join((j for j in lst))
print(s)


(n, t) = map(int, input().split(' '))
s = input()
i = 0
if n > 1:
	while i < t:
		j = 0
		op = ''
		while j < n - 1:
			if s[j] + s[j + 1] == 'BG':
				op += 'GB'
				j = j + 2
			elif s[j] + s[j + 1] == 'GG':
				op += 'GG'
				j = j + 2
			elif s[j] + s[j + 1] == 'BB':
				if j == n - 2:
					op += 'BB'
					break
				else:
					op += 'B'
					j = j + 1
			elif s[j] + s[j + 1] == 'GB':
				if j == n - 2:
					op += 'GB'
					break
				else:
					op += 'G'
					j = j + 1
			if j == n - 1:
				op += s[j]
		s = op
		i += 1
print(s)


w = input().split()
n = int(w[0])
t = int(w[1])
fila = input()
c = 0
for i in range(t):
	while c < n - 1:
		if fila[c] == 'B' and fila[c + 1] == 'G':
			fila = fila[:c] + 'GB' + fila[c + 2:]
			c += 1
		c += 1
	c = 0
print(fila)


class Code:

	def __init__(self):
		(self.n, self.t) = list(map(int, input().split()))
		self.s = input()
		self.s1 = ''

	def process(self):
		for _ in range(self.t):
			self.s = self.s.replace('BG', 'GB')
		print(self.s)
code = Code()
code.process()


(n, t) = map(int, input().split())
s = input()
s += 'A'
for i in range(t):
	update_s = ''
	j = 0
	while j < n:
		if s[j] == 'B' and s[j + 1] == 'G':
			update_s += 'GB'
			j += 1
		else:
			update_s += s[j]
		j += 1
	s = update_s + 'A'
print(s[:-1])


(n, t) = input().split()
string = input()
t = int(t)
while t:
	string = string.replace('BG', 'GB')
	t -= 1
print(string)


(n, k) = [int(x) for x in input().split()]
s = input()
arr = []
for i in s:
	arr.append(i)
for _ in range(k):
	temp = [i for i in arr]
	for i in range(n - 1):
		if arr[i] == 'B' and arr[i + 1] == 'G':
			(temp[i], temp[i + 1]) = (temp[i + 1], temp[i])
	arr = temp
for i in arr:
	print(i, end='')


(n, t) = input().split()
n = int(n)
t = int(t)
c = input()
c = list(c)
d = list()
e = list()
z = ''
for i in range(0, len(c)):
	if c[i] == 'B':
		d.append(i)
	else:
		e.append(i)
for i in range(0, t):
	for j in range(len(e) - 1, -1, -1):
		if e[j] - 1 in d:
			x = d.index(e[j] - 1)
			d[x] = d[x] + 1
			e[j] = e[j] - 1
for i in range(0, len(c)):
	if i in d:
		z = z + 'B'
	else:
		z = z + 'G'
print(z)


(n, t) = [int(x) for x in input().split()]
s = input()

def queue(s, t):
	s = [x for x in s]
	for x in range(t):
		i = len(s) - 1
		while i > 0:
			if s[i] == 'G' and s[i - 1] == 'B':
				(s[i], s[i - 1]) = (s[i - 1], s[i])
				i -= 2
			else:
				i -= 1
	return ''.join(s)
print(queue(s, t))


(a, b) = map(int, input().split())
t = input()
i = 0
while i < b:
	if 'BG' in t:
		t = t.replace('BG', 'GB')
	i += 1
print(t)


(n, t) = map(int, input().split())
fila = list(input())
a = ''
for i in range(t):
	x = 0
	while x < len(fila) - 1:
		if fila[x] == 'B' and fila[x + 1] == 'G':
			fila[x] = 'G'
			fila[x + 1] = 'B'
			x += 2
		else:
			x += 1
for l in fila:
	a += l
print(a)


z = [int(s) for s in input().split()]
s = list(input())
k = 0
for j in range(z[1]):
	for i in range(z[0] - 1, 0, -1):
		if k == 1:
			k = 0
			continue
		if s[i] == 'G' and s[i - 1] == 'B':
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			k += 1
print(''.join(s))


def queue(s, t):
	while t != 0:
		i = 1
		while i > 0 and i < len(s):
			if s[i] == 'G' and s[i - 1] == 'B':
				s[i] = 'B'
				s[i - 1] = 'G'
				i += 1
			i += 1
		t -= 1
	return s
nt = input().split(' ')
st = ''
n = int(nt[0])
t = int(nt[1])
s = list(input())
fs = queue(s, t)
print(st.join(fs))


(a, b) = (int(i) for i in input().split())
ch = input()
k = 'BG'
for i in range(b):
	ch = ch.replace(k, k[::-1])
print(ch)


(m, n) = map(int, input().split())
qu = input()
for i in range(n):
	qu = qu.replace('BG', 'GB')
print(qu)


(n, t) = [int(i) for i in input().split()]
line = input()
i = 0
while i < t:
	pre = line
	line = line.replace('BG', 'GB')
	i += 1
	if pre == line:
		break
print(line)


def transform_queue(initial_queue: list, t: int) -> str:
	for time in range(t):
		index = 1
		while index < len(initial_queue):
			if initial_queue[index] == 'G' and initial_queue[index - 1] == 'B':
				(initial_queue[index], initial_queue[index - 1]) = (initial_queue[index - 1], initial_queue[index])
				index += 1
			index += 1
	return ''.join(initial_queue)

def main():
	(n, t) = map(int, input().strip().split())
	initial_queue = input().strip()
	print(transform_queue(list(initial_queue), t))
main()


import math as mt
import sys as sy

class abc:

	def mkl(self):
		(n, t) = map(int, sy.stdin.readline().split())
		s = input()
		s1 = list(s)
		for _ in range(t):
			i = 0
			while i < len(s1) - 1:
				if s1[i] == 'B' and s1[i + 1] == 'G':
					(s1[i], s1[i + 1]) = (s1[i + 1], s1[i])
					i += 2
				else:
					i += 1
		print(''.join((i for i in s1)))
b = abc()
b.mkl()


number = input()
number = number.split(' ')
total = int(number[0])
time = int(number[1])
txt = input()
for i in range(time):
	txt = txt.replace('BG', 'GB')
print(txt)


(n, m) = [int(i) for i in input().split()]
a = input('')
a = [char for char in a]
if 'B' in a:
	for x in range(m):
		i = a.index('B')
		while i < len(a):
			if a[i] == 'G':
				(a[i], a[i - 1]) = (a[i - 1], a[i])
				i += 1
			i += 1
for i in a:
	print(i, end='')


arr = input().split()
q_len = int(arr[0])
seconds = int(arr[1])
queue = list(input())
queue.append('0')
newq = queue.copy()
for i in range(seconds):
	for j in range(q_len):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			newq[j] = 'G'
			newq[j + 1] = 'B'
	queue = newq.copy()
queue.pop()
print(''.join(queue))


(n, t) = map(int, input().split())
string = input()
for i in range(t):
	j = 0
	while j < n - 1:
		if string[j + 1] == 'G' and string[j] == 'B':
			string = string[:j] + 'GB' + string[j + 2:]
			j += 2
		else:
			j += 1
print(string)


(n, m) = map(int, input().split())
li = input()
for i in range(m):
	li = li.replace('BG', 'GB')
print(''.join(li))


import re
(a, b) = map(int, input().split())
c = input()
z = c
for i in range(b):
	z = re.sub('BG', 'GB', z)
print(z)


(n, t) = [int(s) for s in input().split()]
q = list(input())
for i in range(t):
	p = 0
	nq = []
	while p + 1 < n:
		if q[p] == 'G':
			nq.append('G')
			p += 1
		elif q[p + 1] == 'G':
			nq.append('G')
			nq.append('B')
			p += 2
		else:
			nq.append('B')
			p += 1
	if p < n:
		nq.append(q[-1])
	q = nq
print(''.join(q))


(n, t) = map(int, input().split())
s = input()
sl = []
for i in s:
	sl.append(i)
while t > 0:
	j = 0
	while j < n - 1:
		if sl[j] == 'B' and sl[j + 1] == 'G':
			sl[j] = 'G'
			sl[j + 1] = 'B'
			j += 1
		j += 1
	t -= 1
res = ''.join(sl)
print(res)


x = input()
(n, t) = (int(x.split()[0]), int(x.split()[1]))
row = input()
row = list(row)
for i in range(t):
	j = 0
	while j <= n - 2:
		if row[j] == 'B' and row[j + 1] == 'G':
			row[j] = 'G'
			row[j + 1] = 'B'
			j += 2
		else:
			j += 1
string = ''
for i in range(n):
	string += row[i]
print(string)


nm = input().split()
n = int(nm[0])
m = int(nm[1])
li = list(map(str, input()))
ab = []
while m != 0:
	ab = []
	for i in range(len(li) - 1):
		if li[i] == 'B' and li[i + 1] == 'G' and (i not in ab) and (i + 1 not in ab):
			li[i] = 'G'
			li[i + 1] = 'B'
			ab.append(i)
			ab.append(i + 1)
	m -= 1
print(''.join(map(str, li)))


a = list(map(int, input().split()))
n = a[0]
t = a[1]
s = input()
b = []
for i in range(n):
	b.append(s[i])
l = len(s)
for k in range(t):
	i = 0
	while i < n - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			cnt = 1
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 2
		else:
			i += 1
for i in range(len(s)):
	print(b[i], end='')
print()


(n, t) = map(int, input().split())
line = list(input())
swaps = []
for i in range(t + 1):
	for j in swaps:
		(line[j], line[j + 1]) = (line[j + 1], line[j])
	swaps = []
	for j in range(n - 1):
		if line[j] == 'B' and line[j + 1] == 'G':
			swaps.append(j)
print(''.join(line))


(n, m) = input().split()
(n, m) = (int(n), int(m))
k = input()
while m > 0:
	k = k.replace('BG', 'GB')
	m = m - 1
print(k)


i = input
(t, c) = (int(i()[-2:]), i())
for x in '_' * t:
	c = c.replace('BG', 'GB')
print(c)


arr = list(map(int, input().split()))
string = input()[:arr[0]]
t = int(arr[1])
temp = string
for i in range(t):
	tt = temp.replace('BG', 'GB')
	temp = tt
print(tt)


def spark(n, s):
	l = list(s)
	i = 0
	while i < n - 1:
		if s[i:i + 2] == 'BG':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 1
		i += 1
	return ''.join(l)
(n, t) = map(int, input().split())
s = input()
for i in range(t):
	s = spark(n, s)
print(s)


(n, k) = map(int, input().split())
s = input()
s = list(s)
q = 0
while q < k:
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
	q += 1
for i in s:
	print(i, end='')


(n, t) = map(int, input().split())
line = list(input())
for i in range(t):
	bad_indices = []
	for j in range(n - 1):
		if [line[j], line[j + 1]] == ['B', 'G']:
			bad_indices.append(j)
	for j in bad_indices:
		line[j] = 'G'
		line[j + 1] = 'B'
ans = ''
for i in line:
	ans += i
print(ans)


(n, t) = map(int, input().split(' '))
s = list(input())

def func(s):
	a = []
	for i in range(len(s)):
		if s[i] == 'B':
			a.append(i)
	return a
for i in range(1, t + 1):
	a = func(s)
	for j in a:
		if j != len(s) - 1:
			(s[j], s[j + 1]) = (s[j + 1], s[j])
print(''.join(s))


(n, t) = map(int, input().split())
queue = list(tuple(input()))
for i in range(t):
	flag = False
	for j in range(1, n):
		if queue[j] == 'G':
			if queue[j] > queue[j - 1] and flag == False:
				temp = queue[j - 1]
				queue[j - 1] = queue[j]
				queue[j] = temp
				flag = True
		elif queue[j] == 'B' and flag == True:
			flag = False
print(''.join(queue))


from sys import stdin

def main():
	(n, t) = map(int, stdin.readline().split())
	s = stdin.readline().strip()
	l = list(s)
	for _ in range(t):
		l1 = l[:]
		for i in range(1, n):
			if l[i] == 'G' != l[i - 1]:
				(l1[i - 1], l1[i]) = ('G', 'B')
		l = l1
	print(''.join(l))
main()


n = list(map(int, input().split()))
m = list(input())
for i in range(n[1]):
	p = []
	for j in range(len(m) - 1):
		if m[j] == 'B' and m[j + 1] == 'G':
			p.append(j)
	for z in p:
		(m[z], m[z + 1]) = (m[z + 1], m[z])
result = ''.join(m)
print(result)


def met(n, t, s):
	r = []
	for i in s:
		if i == 'B':
			r.append(1)
		else:
			r.append(0)
	for k in range(t):
		i = 0
		while i < n - 1:
			if r[i] == 1 and r[i + 1] == 0:
				r[i] = 0
				r[i + 1] = 1
				i += 1
			i += 1
	re = ''
	for i in range(n):
		if r[i] == 0:
			re += 'G'
		else:
			re += 'B'
	return re
(n, t) = tuple(map(int, input().split(' ')))
s = input()
print(met(n, t, s))


(n, t) = input().split()
(n, t) = (int(n), int(t))
main_str = input()
list_str = list(main_str)
pos = 0
cheak = 0
while t != 0:
	no_of_bg = main_str.count('BG')
	pos = 0
	for i in range(no_of_bg):
		pos = main_str.find('BG', pos)
		(list_str[pos], list_str[pos + 1]) = (list_str[pos + 1], list_str[pos])
		main_str = ''.join(list_str)
		pos = pos + 2
	t -= 1
print(main_str)


prompt = [int(i) for i in input().split(' ')]
queue = [i for i in input()]
for i in range(prompt[1]):
	skip = False
	for i in range(0, prompt[0] - 1):
		if skip == True:
			skip = False
			continue
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			skip = True
print(''.join(queue))


console = input().split()
n = int(console[0])
t = int(console[1])
queue = input()
Queue = [queue[i] for i in range(n)]
for i in range(t):
	j = 0
	while j < n - 1:
		if Queue[j] < Queue[j + 1]:
			void = Queue[j]
			Queue[j] = Queue[j + 1]
			Queue[j + 1] = void
			j += 1
		j += 1
for i in range(n):
	print(Queue[i], end='')


(a, b) = map(int, input().split())
q = input()
p = ''
for i in range(0, b):
	j = 0
	while j <= len(q) - 2:
		if q[j] == 'B' and q[j + 1] == 'G':
			p = p + 'GB'
			j = j + 2
		else:
			p = p + q[j]
			j = j + 1
	if j == len(q) - 1:
		p = p + q[j]
	q = p
	p = ''
print(q)


(n, t) = map(int, input().split())
z = list(map(str, input()))
for j in range(t):
	i = 0
	while i != n - 1:
		if z[i] == 'B' and z[i + 1] == 'G':
			(z[i], z[i + 1]) = (z[i + 1], z[i])
			i += 1
			if i == n - 1:
				break
		i += 1
print(*z, sep='')


a = list(map(int, input().split()))
n = a[0]
t = a[1]
s = input()
ans = s
for j in range(t):
	s = ans
	ans = ''
	i = 0
	while True:
		if s[i] == 'G':
			ans += 'G'
			i += 1
			if len(ans) == n:
				break
		if s[i] == 'B':
			if i == n - 1:
				if s[n - 1] == 'B':
					ans += 'B'
			elif s[i + 1] == 'G':
				ans += 'GB'
				i += 2
			else:
				ans += 'B'
				i += 1
		if len(ans) == n:
			break
print(ans)


a = list(input().split())
n = int(a[0])
t = int(a[1])
b = list(input())
k = t
while k > 0:
	i = 1
	while i < n:
		if b[i] == 'G':
			if b[i - 1] == 'B':
				(b[i], b[i - 1]) = (b[i - 1], b[i])
			i = i + 2
		else:
			i = i + 1
	k = k - 1
c = ''.join(b)
print(c)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, t) = map(int, input().split(' '))
a = list(input())
i = 0
if n == t:
	print(''.join(sorted(a, reverse=True)))
elif n == 1:
	print(a[0])
else:
	while t:
		x = [''] * n
		for i in range(n - 1):
			if a[i] == 'B' and a[i + 1] == 'G':
				x[i] = 'G'
				x[i + 1] = 'B'
			else:
				if not x[i]:
					x[i] = a[i]
				x[i + 1] = a[i + 1]
		a = x
		t -= 1
	print(''.join(a))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	x = []
	for j in range(len(s) - 1):
		if (s[j], s[j + 1]) == ('B', 'G'):
			x.append(j)
	for k in x:
		(s[k], s[k + 1]) = (s[k + 1], s[k])
print(''.join(s))


(a, b) = input().split()
a = int(a)
b = int(b)
x = input()
j = len(x)
for i in range(0, b):
	x = x.replace('BG', 'GB')
print(x)


(n, t) = map(int, input().split())
queue = list(input().strip())
cpqueue = queue.copy()
for j in range(t):
	for i in range(1, n):
		if queue[i - 1] == 'B' and queue[i] == 'G':
			(cpqueue[i - 1], cpqueue[i]) = (cpqueue[i], cpqueue[i - 1])
	queue = cpqueue.copy()
print(''.join(cpqueue))


[m, n] = [int(x) for x in input().split()]
p = list(input())
for i in range(n):
	j = 0
	while j < m:
		if j + 1 < m:
			if p[j] == 'B' and p[j + 1] == 'G':
				p[j] = 'G'
				p[j + 1] = 'B'
				j = j + 2
			else:
				j = j + 1
		else:
			break
print(''.join(p))


(n, t) = map(int, input().split())
line = input()
output = [None] * len(line)
for sec in range(t):
	i = 0
	while i < len(line) - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			output[i + 1] = 'B'
			output[i] = 'G'
			i += 1
		else:
			output[i] = line[i]
		i += 1
	if i == len(line) - 1:
		output[i] = line[i]
	line = ''.join(output)
print(line)


def main(s, t):
	s = list(s)
	for i in range(t):
		touch = 0
		i = 0
		while i < len(s) - 1:
			touch = 0
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				touch = 1
			i += 1 + touch
	print(''.join(s))
(n, t) = list(map(int, input().split(' ')))
s = input()
main(s, t)


(n, t) = map(int, input().split())
seq = list(input())
for ii in range(t):
	skip = 0
	for i in range(n - 1):
		if seq[i] == 'B' and seq[i + 1] == 'G' and (skip == 0):
			(seq[i], seq[i + 1]) = (seq[i + 1], seq[i])
			skip = 1
		else:
			skip = 0
print(''.join(seq))


(a, b) = [int(x) for x in input().split()]
dui = input()
for i in range(b):
	dui2 = dui
	for j in range(a - 1):
		if dui[j] == 'B' and dui[j + 1] == 'G':
			dui2 = dui2[:j] + dui2[j + 1] + dui2[j] + dui2[j + 2:]
	dui = dui2
print(dui)


def reorder(queue):
	copyQueue = list(queue)
	i = 0
	while i < len(copyQueue):
		if i < len(copyQueue) - 1:
			if copyQueue[i] == 'B' and copyQueue[i + 1] == 'G':
				copyQueue[i] = 'G'
				copyQueue[i + 1] = 'B'
				i += 2
				continue
		i += 1
	return copyQueue
(n, t) = list(map(int, input().split()))
queue = input()
for i in range(t):
	queue = reorder(queue)
result = str('')
result = result.join(queue)
print(result)


k = input().split()
n = int(k[0])
t = int(k[1])
s = input()
for _ in range(t):
	s2 = s[:]
	for i in range(1, len(s)):
		if s[i] == 'G' and s[i - 1] == 'B':
			s2 = s2[:i - 1] + s2[i] + s2[i - 1] + s2[i + 1:]
	s = s2
print(s)


p = input().split()
n = int(p[0])
t = int(p[1])
q = input()
while t > 0:
	t -= 1
	q = q.replace('BG', 'GB')
print(q)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
s = input()
newStr = ''
tmpStr = s
skip_two = False
for k in range(t):
	for i in range(n):
		if skip_two:
			skip_two = False
			continue
		if i == n - 1:
			newStr += tmpStr[i]
			continue
		if tmpStr[i] == 'G':
			newStr += tmpStr[i]
		elif tmpStr[i] == 'B' and tmpStr[i + 1] == 'B':
			newStr += tmpStr[i]
		elif tmpStr[i] == 'B' and tmpStr[i + 1] == 'G':
			newStr += tmpStr[i + 1]
			newStr += tmpStr[i]
			skip_two = True
	tmpStr = newStr
	newStr = ''
print(tmpStr)


def gentlemen():
	for _ in range(t):
		ind = 1
		while ind < n:
			if queue[ind - 1] == 'B' and queue[ind] == 'G':
				(queue[ind], queue[ind - 1]) = (queue[ind - 1], queue[ind])
				ind += 1
			ind += 1
	return queue
(n, t) = list(map(int, input().split()))
queue = list(input())
print(*gentlemen(), sep='')


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	st = ''
	j = 0
	while 1:
		if j >= n:
			break
		if s[j:j + 2] == 'BG':
			st += 'GB'
			j += 1
		else:
			st += s[j]
		j += 1
	s = st
print(s)


(l, t) = map(int, input().split())
q = list(input())

def swap(queue):
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 1
		i += 1
for i in range(t):
	swap(q)
print(''.join(q))


import sys
(n, t) = map(int, sys.stdin.readline().split(' '))
line = list(sys.stdin.readline().strip())
newLine = ['0'] * n
for x in range(n):
	newLine[x] = line[x]
for time in range(t):
	for x in range(n - 1):
		if line[x] == 'B' and line[x + 1] == 'G':
			newLine[x] = 'G'
			newLine[x + 1] = 'B'
	for x in range(n):
		line[x] = newLine[x]
print(''.join(newLine))


(n, t) = map(int, input().split())
s = input()
s = list(s)
k = 1
while k <= t:
	list = []
	for i in range(0, n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			list.append(i)
	m = len(list)
	if m == 0:
		break
	for j in list:
		if j < n - 1:
			s[j] = 'G'
			s[j + 1] = 'B'
	k = k + 1
s = ''.join(s)
print(s)


(n, t) = map(int, input().split())
s = list(input())
s.append('')
for k in range(t):
	i = 0
	while i < n - 1:
		try:
			a = s.index('B', i)
			if s[a + 1] == 'G':
				(s[a], s[a + 1]) = ('G', 'B')
				i = a + 2
			else:
				i = a + 1
		except ValueError:
			break
x = ''
for i in s:
	x += i
print(x)


(n, t) = map(int, input().split())
q = list(input())
for j in range(0, t):
	count = 0
	for i in range(0, n - 1):
		if q[i] == 'B' and q[i + 1] == 'G' and (count == 0):
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			count = 1
		else:
			count = 0
print(''.join(q))


a = str(input())
n = int(a.split(' ')[0])
t = int(a.split(' ')[1])
line = str(input())
line = list(line)
G = False
counter = len(line) - 1
for i in range(t):
	for char in reversed(line):
		if char == 'G':
			G = True
			counter -= 1
			continue
		if char == 'B' and G:
			line[counter] = 'G'
			line[counter + 1] = 'B'
			G = False
		counter -= 1
	counter = len(line) - 1
	G = False
print(''.join(line))


from sys import stdin
(total_children, check_time) = (int(i) for i in stdin.readline().rstrip().split())
initial_queue = stdin.readline().rstrip()
for i in range(check_time):
	(j, flag, mod_queue) = (0, True, list())
	while j < total_children:
		if initial_queue[j] == 'G' and flag:
			if mod_queue and mod_queue[j - 1] == 'B':
				mod_queue.pop()
				mod_queue.append('G')
				mod_queue.append('B')
				flag = False
			else:
				mod_queue.append('G')
		else:
			mod_queue.append(initial_queue[j])
			flag = True
		j += 1
	initial_queue = mod_queue[:]
print(''.join(initial_queue))


def f(x, s):
	if x[s] == 'B' and x[s + 1] == 'G':
		return 'G'
	if x[s] == 'G' and x[s - 1] == 'B':
		return 'B'
	else:
		return x[s]
(n, t) = [int(x) for x in input().split()]
s = 'A' + input() + 'A'
for i in range(t):
	answer = ['A', 'A']
	for r in range(n):
		answer.insert(r + 1, f(s, r + 1))
	s = ''.join(answer)
s = s[1:n + 1]
print(s)


import copy
(n, t) = map(int, input().split())
str = list(input())
while t > 0:
	t -= 1
	new_str = copy.deepcopy(str)
	for i in range(n - 1):
		if str[i] == 'B' and str[i + 1] == 'G':
			new_str[i] = 'G'
			new_str[i + 1] = 'B'
	str = copy.deepcopy(new_str)
print(''.join(str))


(n, t) = map(int, input().split())
a = list(input())
change = 0
for i in range(t):
	for j in range(n - 1):
		if a[j] == 'B' and a[j + 1] == 'G':
			if not change:
				(a[j], a[j + 1]) = (a[j + 1], a[j])
				change = 1
			else:
				change = 0
		else:
			change = 0
	change = 0
print(''.join(a))


(n, t) = map(int, input().split())
s = list(input())
ans = ''
l = []
for j in range(t):
	i = 1
	while i != n:
		if s[i - 1] == 'B' and s[i] == 'G':
			s[i - 1] = 'G'
			s[i] = 'B'
			if i + 2 <= n:
				i += 2
			else:
				i += 1
		else:
			i += 1
for k in range(n):
	ans = ans + s[k]
print(ans)


(n, t) = list(map(int, input().split()))
s = list(str(input()))
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			tt = s[j]
			s[j] = s[j + 1]
			s[j + 1] = tt
			j += 1
		j += 1
ss = ''.join(map(str, s))
print(ss)


(n, t) = (int(i) for i in input().split())
q = [i for i in ' '.join(input()).split()]
a = []
for i in range(n):
	if q[i] == 'B':
		a.append(i)
for j in range(t):
	for i in range(len(a)):
		if a[i] != len(q) - 1:
			if q[a[i] + 1] == 'G':
				(q[a[i]], q[a[i] + 1]) = (q[a[i] + 1], q[a[i]])
				a[i] += 1
print(''.join(q))


(n, t) = list(map(int, input().strip().split()))
queue = input().strip()
for _ in range(t):
	ctr = queue.count('BG')
	queue = queue.replace('BG', 'GB', ctr)
	if ctr == 0:
		break
print(queue)


(n, k) = map(int, input().split())
queue = input()
string = 'BG'
for i in range(k):
	if string in queue:
		a = queue.replace('BG', 'GB')
		queue = a
	else:
		print(queue)
		break
else:
	print(a)


(n, t) = map(int, input().split())
x = input()
l = list(x)
l1 = []
for _ in range(t):
	for i in range(1, len(l)):
		if l[i - 1] == 'B' and l[i] == 'G':
			l1.append(i)
	for i in l1:
		temp = l[i]
		l[i] = l[i - 1]
		l[i - 1] = temp
	l1 = []
for i in l:
	print(i, end='')


x = input().split()
n = int(x[0])
t = int(x[1])
q = input()
lista = []
for i in q:
	lista.append(i)
for j in range(t):
	i = 0
	while i < len(lista):
		if i + 1 >= len(lista):
			break
		if lista[i + 1] == 'G' and lista[i] == 'B':
			lista[i] = 'G'
			lista[i + 1] = 'B'
			i += 1
		i += 1
res = ''
for i in range(len(lista)):
	res = res + lista[i]
print(res)


params = input().split()
bg = list(input())
new = bg[:]
for k in range(int(params[1])):
	for i in range(int(params[0])):
		if i < len(bg) - 1:
			if bg[i] == 'B' and bg[i + 1] == 'G':
				new[i] = 'G'
				new[i + 1] = 'B'
	bg = new
	new = bg[:]
print(''.join(new))


def swap(c, i, j):
	c = list(c)
	(c[i], c[j]) = (c[j], c[i])
	return ''.join(c)
(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
for i in range(t):
	a = [0] * n
	for j in range(n - 1):
		if (s[j] == 'B' and s[j + 1] == 'G') and (a[j] == 0 and a[j + 1] == 0):
			s = swap(s, j, j + 1)
			a[j] = 1
			a[j + 1] = 1
print(s)


(s, b) = (int(x) for x in input().split())
a = input()
i = 0
while i < b:
	a = a.replace('BG', 'GB')
	i += 1
print(a)


def main():
	(n, sec) = [int(i) for i in input().split(' ')]
	gr = [c for c in input()]
	end = sorted(gr, reverse=True)
	while sec > 0:
		if gr == end:
			break
		sec -= 1
		i = 0
		while i + 1 < n:
			if gr[i] == 'B' and gr[i + 1] == 'G':
				gr[i] = 'G'
				gr[i + 1] = 'B'
				i += 2
			else:
				i += 1
	print(''.join(gr))
main()


(n, m) = map(int, input().split(' '))
a = input()
b = []
for j in a:
	b.append(j)
for e in range(m):
	i = 1
	while i < len(b):
		if b[i - 1] == 'B' and b[i] == 'G':
			b.pop(i - 1)
			b.insert(i, 'B')
			i += 1
		i += 1
print(''.join(b))


import random
import sys
import os
s = input()
l = s.split()
n = int(l[0])
k = int(l[1])
s = input()
a = list(s)
skip = False
for i in range(0, k):
	for j in range(0, n):
		if not skip and j + 1 < n and (a[j] == 'B') and (a[j + 1] == 'G'):
			a[j] = 'G'
			a[j + 1] = 'B'
			skip = True
		else:
			skip = False
ans = ''.join(a)
print(ans + '\n')


(n, t) = map(int, input().strip().split())
line = list(input())
for i in range(t):
	line2 = line.copy()
	for j in range(len(line) - 1):
		if line2[j] == 'B' and line2[j + 1] == 'G':
			(line[j], line[j + 1]) = (line[j + 1], line[j])
			''.join(line)
print(''.join(line))


(n, t) = map(int, input().split())
string = input()
while t != 0:
	t -= 1
	lista = list(string)
	string = ''
	for i in range(0, n - 1):
		if lista[i] == 'B' and lista[i + 1] == 'G':
			lista[i] = '-'
			(lista[i], lista[i + 1]) = (lista[i + 1], lista[i])
	for i in lista:
		string += i
	string = string.replace('-', 'B')
print(string)


(_, t) = map(int, input().split())
task = list([ch for ch in input()])
for _ in range(t):
	i = 0
	while i < len(task) - 1:
		if task[i] == 'B' and task[i + 1] == 'G':
			(task[i], task[i + 1]) = (task[i + 1], task[i])
			i += 1
		i += 1
print(''.join(task))


def test():
	(n, t) = input().split()
	seq = input()
	ans = []
	for i in seq:
		ans.append(i)
	for i in range(int(t)):
		for j in range(int(n) - 1):
			if seq[j] == 'B' and seq[j + 1] == 'G':
				(ans[j], ans[j + 1]) = (ans[j + 1], ans[j])
		seq = ans.copy()
	print(''.join(ans))
test()


(a, b) = list(map(int, input().split()))
c = input()
for i in range(0, b):
	c = c.replace('BG', 'GB')
print(c)


import sys, os.path
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
sys.setrecursionlimit(10 ** 5)

def ii():
	return int(sys.stdin.readline())

def mi():
	return map(int, sys.stdin.readline().split())

def li():
	return list(map(int, sys.stdin.readline().split()))
print = sys.stdout.write

def solve():
	(a, b) = mi()
	c = list(input())
	for _ in range(b):
		j = 0
		while j <= a - 2:
			if c[j] == 'B' and c[j + 1] == 'G':
				(c[j], c[j + 1]) = (c[j + 1], c[j])
				j += 2
			else:
				j += 1
	s = ''.join(c)
	print(s)
solve()


(n, t) = map(int, input().split())
str1 = list(input())
list1 = []
for j in range(t):
	for i in range(len(str1) - 1):
		if str1[i] == 'B' and str1[i + 1] == 'G':
			list1.append(i)
	for k in range(len(list1)):
		str1[list1[k]] = 'G'
		str1[list1[k] + 1] = 'B'
	list1 = []
print(''.join(str1))


nums = input('')
(n, t) = nums.split(' ')
(n, t) = (int(n), int(t))
s = input('')
ar = []
for char in s:
	ar.append(char)
for element in range(0, t):
	i = 0
	while i < n - 1:
		if ar[i] == 'B' and ar[i + 1] == 'G':
			ar[i] = 'G'
			ar[i + 1] = 'B'
			i += 2
		else:
			i += 1
string = ''.join(ar)
print(string)


(x, y) = map(int, input().split())
a = list(input())
while y > 0:
	i = 0
	while i < len(a) - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
	y -= 1
print(''.join(a))


(N, T) = input().split()
n = int(N)
t = int(T)
s = list(input())
j = 0
while j < t:
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			if i + 2 < n:
				if s[i + 2] == 'G':
					i += 1
		i += 1
	j += 1
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
a = s[:]
b = 0
while b < t:
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
	s = a[:]
	b += 1
for i in range(len(a)):
	print(a[i], end='')


(n, t) = map(int, input().split())
S = list(input())
while 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
		else:
			i += 1
	t -= 1
for x in S:
	print(x, end='')


def main():
	(t, s) = (int(input().split()[1]), input())
	for _ in range(t):
		s = s.replace('BG', 'GB')
	print(s)
main()


(a, b) = input().split()
d = 0
a = int(a)
b = int(b)
s = input()
while b:
	s = s.replace('BG', 'GB')
	b -= 1
print(s)


(n, t) = map(int, input().split())
s = list(input())
for i in range(0, t):
	j = 0
	while j < n:
		if s[j:j + 2] == ['B', 'G']:
			s[j:j + 2] = ['G', 'B']
			j += 1
		j += 1
print(''.join(s))


def proA(st, t):
	arr = list(st)
	for i in range(t):
		ans = []
		for j in range(len(arr) - 1):
			if arr[j] == 'B' and arr[j + 1] == 'G':
				ans.append(j)
		for j in ans:
			(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
	for i in arr:
		print(i, end='')
arr = list(map(int, input().split()))
(n, t) = arr
st = input()
proA(st, t)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
line = input()
lineList = [x for x in line]
for tt in range(t):
	hasSwapped = False
	for i in range(n - 1):
		if lineList[i] == 'B' and lineList[i + 1] == 'G' and (not hasSwapped):
			lineList[i] = 'G'
			lineList[i + 1] = 'B'
			i += 1
			hasSwapped = True
		else:
			hasSwapped = False
print(''.join(lineList))


(l, t) = map(int, input().split())
K = [i for i in input()]
K.append('B')
for i in range(t):
	S = K[:]
	for j in range(l):
		if K[j] == 'B' and K[j + 1] == 'G':
			(S[j], S[j + 1]) = ('G', 'B')
	K = S[:]
K.pop(-1)
print(''.join(K))


(n, c) = map(int, input().split())
s = input()
otv = ''
a = 0
while a != c:
	s1 = []
	r = 0
	while r - 1 <= n - 2:
		if r < n - 1 and s[r] == 'B' and (s[r + 1] == 'G'):
			s1.append('G')
			s1.append('B')
			r += 1
		else:
			s1.append(s[r])
		r += 1
	a += 1
	s = s1
for i in range(len(s1)):
	otv += s1[i]
print(otv)


(n, t) = map(int, input().split())
a = list(input())

def num(a):
	l = []
	for i in range(1, n):
		if a[i - 1] == 'B' and a[i] == 'G':
			l.append(i - 1)
			l.append(i)
	return l
b = []
while t > 0:
	l = num(a)
	i = 0
	while i < n:
		if i in l and int(l.index(i) % 2) == 0:
			b.append('G')
		elif i in l and int(l.index(i) % 2) != 0:
			b.append('B')
		else:
			b.append(a[i])
		i += 1
	t -= 1
	a = b.copy()
	if t == 0:
		pass
	else:
		b = []
print(''.join(b))


(childern_count, time) = map(int, input().split())
queue = input()
can_change_list = []
for i in queue:
	can_change_list.append(i)
is_swap = 0
for i in range(time):
	for j in range(childern_count - 1):
		if can_change_list[j] == 'B' and can_change_list[j + 1] == 'G' and (is_swap == 0):
			can_change_list[j] = 'G'
			can_change_list[j + 1] = 'B'
			is_swap = 1
		else:
			is_swap = 0
	is_swap = 0
answer = ''
for i in can_change_list:
	answer += i
print(answer)


def func(a, n):
	b = ''
	lastchange = False
	for i in range(n):
		if lastchange:
			if a[i] == 'G':
				b += 'B'
				lastchange = False
			elif a[i] == 'B':
				b += 'B'
		else:
			try:
				if a[i] == 'B' and a[i + 1] == 'G':
					b += 'G'
					lastchange = True
				elif a[i] == 'G':
					b += 'G'
				elif a[i] == 'B' and a[i + 1] == 'B':
					b += 'B'
			except:
				b += a[i]
	return b
(n, t) = map(int, input().split())
a = input()
b = a
for j in range(t):
	b = func(b, n)
print(b)


tstring = str(input())
queuelist = list(input())
finalqueue = ''
t = int(tstring[tstring.index(' ') + 1:])
for j in range(0, t):
	for i in range(0, len(queuelist) - 1):
		if queuelist[i] == 'B' and queuelist[i + 1] == 'G':
			queuelist[i] = 'G'
			queuelist[i + 1] = 'X'
	for i in range(0, len(queuelist)):
		if queuelist[i] == 'X':
			queuelist[i] = 'B'
for i in range(0, len(queuelist)):
	finalqueue += queuelist[i]
print(finalqueue)


import sys
(number, time) = map(int, sys.stdin.readline().split())
string = input()
queue = list(string)
while time > 0:
	check = -1
	for j in range(number - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G' and (time >= 1) and (j != check):
			temp = queue[j]
			queue[j] = queue[j + 1]
			queue[j + 1] = temp
			check = j + 1
	time -= 1
print(''.join(queue))


from sys import stdin, stdout

def main():
	(n, t) = [int(i) for i in stdin.readline().split()]
	string = stdin.readline().strip()
	for i in range(t):
		string = string.replace('BG', 'GB')
	stdout.write(string + '\n')
main()


n = list(map(int, input().split(' ')))
s = list(input())
for i in range(n[1]):
	j = 0
	while j < len(s) - 1:
		if s[j] == 'G':
			j = j + 1
		elif s[j] == 'B':
			if s[j + 1] == 'B':
				j = j + 1
			else:
				s[j] = 'G'
				s[j + 1] = 'B'
				if j + 2 < len(s):
					j = j + 2
				else:
					break
print(''.join(s))


s = input().split()
l = int(s[0])
t = int(s[1])
p = 0
r = input()
s1 = []
s1[:] = r
for i in range(t):
	p = 0
	for j in range(1, l):
		if p == 1:
			p = 0
			continue
		elif s1[j - 1] == 'B' and s1[j] == 'G':
			s1[j - 1] = 'G'
			s1[j] = 'B'
			p = 1
s2 = ''.join(s1)
print(s2)


def get_next(s):
	s1 = ''
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s1 = s1 + 'G' + 'B'
			i = i + 2
		else:
			s1 = s1 + s[i]
			i = i + 1
	if i < len(s):
		s1 = s1 + s[i]
	return s1
(a, b) = map(int, input().split())
s = input()
for i in range(0, b):
	s = get_next(s)
print(s)


def main():
	inp = input()
	(n, t) = inp.split()
	string = list(input())
	j = 0
	for i in range(0, int(t)):
		while j < len(string):
			if j + 1 < len(string):
				if string[j] == 'B' and string[j + 1] == 'G':
					aux = string[j]
					string[j] = string[j + 1]
					string[j + 1] = aux
					j += 1
			j += 1
		j = 0
	print(''.join(string))
main()


(n, t) = map(int, input().split())
s = [c for c in input().strip()]
for i in range(t):
	j = 1
	while j < n:
		if s[j] == 'G' and s[j - 1] == 'B':
			(s[j], s[j - 1]) = (s[j - 1], s[j])
			j += 1
		j += 1
print(''.join(s))


(x, n) = list(map(int, input().split()))
q = list(input())
for _ in range(n):
	swapped = [False] * len(q)
	for (index, value) in enumerate(q):
		if value == 'G' and index - 1 >= 0 and (q[index - 1] == 'B') and (not swapped[index - 1]):
			(q[index], q[index - 1]) = (q[index - 1], q[index])
			swapped[index] = True
print(''.join(q))


n = list(map(int, input().split()))
fila = input()
seq = []
for i in range(len(fila)):
	seq.append(fila[i])
block = []
count = 0
while count < n[1]:
	for i in range(len(seq) - 1):
		if seq[i] == 'B' and seq[i + 1] == 'G' and (i not in block):
			seq.pop(i)
			seq.insert(i + 1, 'B')
			block.append(i + 1)
		elif seq[i] == 'G' and i not in block:
			block.append(i)
	count += 1
	block = []
print(''.join(seq))


[n, t] = [int(i) for i in input().split()]
l = [c for c in input()]
for x in range(t):
	a = [a for a in l]
	for (i, v) in enumerate(a):
		if v == 'B':
			if i < n - 1:
				l[i] = l[i + 1]
				l[i + 1] = 'B'
print(''.join(l))


a = [int(x) for x in input().split()]
string = input()
string = list(string)
counterB = 0
counterG = 0
for i in range(0, len(string)):
	if string[i] == 'B':
		counterB += 1
	else:
		counterG += 1
smallest = counterB if counterB <= counterG else counterG
for j in range(0, a[1]):
	counter = 0
	i = len(string) - 1
	while i >= 0:
		if i < len(string) - 1 and string[i] == 'B' and (string[i + 1] == 'G'):
			string[i] = 'G'
			string[i + 1] = 'B'
			counter += 1
			i -= 1
		if counter == smallest:
			break
		i -= 1
print(''.join(string))


def step(queue):
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue = queue[0:i] + 'GB' + queue[i + 2:]
			i += 2
		else:
			i += 1
	return queue
(l, t) = (int(i) for i in input().split(' '))
queue = input()
for i in range(t):
	queue = step(queue)
print(queue)


import math
import sys

def cantina():
	datain = []
	queue = []
	for i in range(2):
		datain.append(input().split())
	time = int(datain[0][1])
	for i in range(len(datain[1][0])):
		queue.append(datain[1][0][i])
	for i in range(time):
		queueswap(queue)
	return queue

def queueswap(queue):
	swaps = []
	for i in range(len(queue) - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			swaps.append(i)
	for i in swaps:
		queue[i] = 'G'
		queue[i + 1] = 'B'
	return queue
print(''.join(cantina()))


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
s = list(s)
for i in range(0, t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += +1
		j += 1
s2 = ''
for i in range(0, len(s)):
	s2 = s2 + s[i]
print(s2)


(n, t) = map(int, input().split())
s = list(input())
while t:
	flag = 0
	i = 0
	while i + 1 < n:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			flag = 1
			i += 1
		i += 1
	if flag == 0:
		break
	t -= 1
print(''.join(s))


def swap(a, b):
	t = a
	a = b
	b = t
	return (a, b)
l = list(input().split())
n = int(l[0])
t = int(l[1])
s = [char for char in input()]
q = []
a = 0
for j in range(t):
	a = 0
	for i in range(n - 1):
		if a == 1:
			a = 0
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = swap(s[i], s[i + 1])
			a = 1
			continue
print(''.join(s))


import math
a = input()
a = a.split()
c = input()
t = int(a[1])
n = int(a[0])
p = 'a'
for j in range(t):
	h = []
	for i in range(n - 1):
		if c[i] == 'B' and c[i + 1] == 'G':
			h.append(i)
	v = []
	v = list(c)
	for i in h:
		p = str(v[i])
		v[i] = v[i + 1]
		v[i + 1] = p
	c = ''.join(v)
print(c)


(n, t) = map(int, input().split())
s = input()
if s.count('B') == 0:
	print(s)
else:
	while t > 0:
		j = 0
		r = ''
		while j < len(s):
			if s[j:j + 2] == 'BG':
				x = s[j:j + 2]
				r += x[::-1]
				j += 2
			else:
				r += s[j]
				j += 1
		s = r
		t += -1
	print(s)


(y, z) = input().split(' ')
n = int(y)
t = int(z)
s = input()
i = 0
d = ''
l = list(s)
while t > 0:
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i = i + 1
		i = i + 1
	t = t - 1
for i in range(len(l)):
	d += l[i]
print(d)


(t, n) = input().split()
n = int(n)
a = input()
while n:
	a = a.replace('BG', 'GB')
	n = n - 1
print(a)


def solution():
	(n, t) = (int(i) for i in input().split())
	queue = [x for x in input()]
	for x in range(t):
		j = 0
		while j < len(queue) - 1:
			if queue[j + 1] == 'G' and queue[j] == 'B':
				(queue[j + 1], queue[j]) = (queue[j], queue[j + 1])
				j += 1
			j += 1
	print(''.join(queue))
solution()


(n, t) = [int(item) for item in input().split()]
a = input()
a = list(a)
for i in range(t):
	j = 0
	while j < n - 1:
		if (a[j] == 'B') & (a[j + 1] == 'G'):
			a[j + 1] = 'B'
			a[j] = 'G'
			j = j + 1
		j = j + 1
for char in a:
	print(char, end='')


(p, q) = map(int, input().split())
lst = list(input())
while q != 0:
	i = 0
	while i < p - 1:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			lst[i] = 'G'
			lst[i + 1] = 'B'
			i += 1
		i += 1
	q -= 1
print(*lst, sep='')


def split(string):
	return [char for char in string]
(n, t) = map(int, input().split())
string = str(input())
string_list = split(string)
for i in range(t):
	j = 1
	while j < n:
		if string_list[j - 1] == 'B' and string_list[j] == 'G':
			temp = string_list[j]
			string_list[j] = string_list[j - 1]
			string_list[j - 1] = temp
			j = j + 2
		else:
			j += 1
print(''.join(string_list))


(n, t) = [int(x) for x in input().split()]
q = [str(x) for x in input()]
i = 0
for _ in range(t):
	flag = False
	for i in range(n - 1):
		if flag:
			flag = False
			continue
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = (q[i + 1], q[i])
			flag = True
print(''.join(q))


(n, t) = map(int, input().split())
q = []
tq = input()
for i in range(len(tq)):
	q.append(tq[i])
for i in range(t):
	garr = []
	for j in range(len(q) - 1):
		if q[j] + q[j + 1] == 'BG':
			garr.append(j + 1)
	for j in range(len(garr)):
		q[garr[j]] = 'B'
		q[garr[j] - 1] = 'G'
for i in range(len(q)):
	print(q[i], end='')


(n, t) = map(int, input().split())
arr = input()
arr = list(arr)
res = ''
while t > 0:
	i = 0
	while i < len(arr) - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
			i += 2
		else:
			i += 1
	t -= 1
for i in range(len(arr)):
	res += arr[i]
print(res)


(n, m) = map(int, input().split())
s = list(input())
for j in range(m):
	q = []
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			q.append(i)
	for i in q:
		s[i] = 'G'
		s[i + 1] = 'B'
print(''.join(s))


(n, a) = input().split()
k = input()
k = [i for i in k]
for i in range(int(a)):
	act = 0
	while act < len(k) - 1:
		if k[act] == 'B' and k[act + 1] == 'G':
			(k[act], k[act + 1]) = ('G', 'B')
			act += 1
		act += 1
k = ''.join(k)
print(k)


(n, t) = map(int, input().split())
s = input()
an = []
for i in range(n):
	an.append(s[i])
for i in range(t):
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			temp = an[j]
			an[j] = an[j + 1]
			an[j + 1] = temp
	s = ''.join(an)
print(s)


def recursion(s, n, t):
	if t == 0:
		print(s)
		return
	s = s.replace('BG', 'GB')
	recursion(s, n, t - 1)
(n, t) = map(int, input().split())
recursion(input(), n, t)


[n, t] = map(int, input().split())
s = input()
u = []
while t != 0:
	i = 0
	while i <= n - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			u.append('G')
			u.append('B')
			i = i + 2
		else:
			u.append(s[i])
			i = i + 1
	if len(u) < n:
		u.append(s[n - 1])
	v = ''
	for j in u:
		v = v + j
	u = []
	s = v
	t -= 1
print(s)


from sys import stdin, stdout

def main():
	(n, t) = map(int, input().split())
	q = list(input())
	for _ in range(t):
		a = q[:]
		for i in range(n - 1):
			if a[i] == 'B' and a[i + 1] == 'G':
				(q[i], q[i + 1]) = (q[i + 1], q[i])
	print(''.join(q))
main()


nt = input().split()
s = input()
arrangement = []
for i in s:
	arrangement.append(i)
for i in range(int(nt[1])):
	j = 0
	while j < len(arrangement) - 1:
		if arrangement[j + 1] == 'G' and arrangement[j] == 'B':
			arrangement[j + 1] = 'B'
			arrangement[j] = 'G'
			j += 1
		j += 1
print(''.join(arrangement))


import re

def change_position(s):
	sList = list(s)
	replace = [m.start() for m in re.finditer('BG', s)]
	for i in replace:
		(sList[i], sList[i + 1]) = ('G', 'B')
	return ''.join(sList)
(n, t) = list(map(int, input().split()))
s = input()
for i in range(t):
	s = change_position(s)
print(s)


(n, t) = [int(i) for i in input().split()]
w = input()
for i in ' ' * t:
	w = 'GB'.join(w.split('BG'))
print(w)


(numberOfChildren, transformationTime) = [int(ip) for ip in input().split(' ')]
queue = input()
for j in range(transformationTime):
	queue = queue.replace('BG', 'GB')
print(queue)


x = input().split()
q = list(input())
for i in range(int(x[1])):
	f = False
	for j in range(int(x[0]) - 1):
		if f:
			f = False
			continue
		if q[j] == 'B' and q[j + 1] == 'G':
			q[j] = 'G'
			q[j + 1] = 'B'
			f = True
res = ''
for ele in q:
	res += ele
print(res)


(n, t) = [int(elem) for elem in input().split(' ')]
queue = [ch for ch in input()]
cont = 0
isSwap = False
for rep in range(t):
	for i in range(n):
		if isSwap == True:
			isSwap = False
			continue
		if queue[i] == 'B' and i + 1 <= n - 1 and (queue[i + 1] == 'G'):
			queue[i] = 'G'
			queue[i + 1] = 'B'
			isSwap = True
print(''.join(queue))


(n, t) = map(int, input().split())
s = input()
a = []
out = []
for i in range(n):
	a.append(s[i])
	out.append(s[i])
cnt = t
while t:
	i = 0
	while i < n - 1:
		if out[i] == 'B' and out[i + 1] == 'G':
			out[i + 1] = 'B'
			out[i] = 'G'
			i += 2
		else:
			i += 1
	t -= 1
ans = ''
for i in range(n):
	ans += out[i]
print(ans)


(n, m) = map(int, input().split())
s = input()
f = -1
for i in range(n):
	if s[i] == 'B':
		f = i
		break
if f == -1:
	print(s)
elif m == 0:
	print(s)
else:
	s = list(s)
	for j in range(m):
		i = 0
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				i += 1
			i += 1
	print(''.join(s))


(pocet, sekund) = map(int, input().split())
(deti, zmena) = (input(), False)
for i in range(sekund):
	zmena = False
	for j in range(pocet - 1):
		if not zmena:
			if deti[j] == 'B' and deti[j + 1] == 'G':
				deti = deti[:j] + 'GB' + deti[j + 2:]
				zmena = True
		else:
			zmena = not zmena
print(deti)


n = input()
n = n.split()
size = int(n[0])
sec = int(n[1])
claz = []
for char in input():
	claz.append(char)
swap = False
while sec > 0:
	for i in range(size):
		if i == size - 1:
			sec -= 1
			swap = False
			continue
		elif claz[i] == 'B' and claz[i + 1] == 'G':
			if swap == False:
				(claz[i], claz[i + 1]) = (claz[i + 1], claz[i])
				swap = True
			else:
				swap = False
		else:
			swap = False
claz = ''.join(claz)
print(claz)


i = int(input().split()[1])
s = input()
for _ in range(i):
	current = ''
	flag = False
	for pos in range(len(s)):
		if flag:
			flag = False
			continue
		if s[pos:pos + 2] == 'BG':
			current += 'GB'
			flag = True
		else:
			current += s[pos]
	s = current
print(s)


(a, b) = input().split()
a = int(a)
b = int(b)
c = input().strip()
for i in range(b):
	j = 0
	while j < len(c) and j + 1 < len(c):
		if c[j] == 'B' and c[j + 1] == 'G':
			c = c[:j] + c[j + 1] + c[j] + c[j + 2:]
			j += 1
		j += 1
print(c)


(n, t) = map(int, input().strip().split())
line = str(input())
LINE = list(line)
r = ''
for k in range(t):
	i = 1
	while i < n:
		if LINE[i - 1] == 'B' and LINE[i] == 'G':
			LINE[i - 1] = 'G'
			LINE[i] = 'B'
			i = i + 1
		i = i + 1
for i in LINE:
	r = r + i
print(r)


s = []
(n, t) = map(int, input().split())
for i in input():
	s += i
while t > 0:
	count = 1
	while count < len(s):
		if s[count - 1] == 'B' and s[count] == 'G':
			(s[count], s[count - 1]) = ('B', 'G')
			count += 1
		count += 1
	t -= 1
print(''.join(s))


str1 = input()
list1 = str1.split(' ')
n = int(list1[0])
t = int(list1[1])
str2 = input()
x = -1
b = str2.count('B')
blist = []
for i in range(0, b):
	x = str2.find('B', x + 1)
	blist.append(x)
if blist == []:
	print(str2)
else:
	for k in range(0, t):
		for j in range(0, b - 1):
			if blist[j] < blist[j + 1] - 1 and blist[j] < n - 1:
				blist[j] += 1
		if blist[b - 1] < n - 1:
			blist[b - 1] += 1
	for i in range(0, n):
		if (i in blist) == True:
			print('B', end='')
		else:
			print('G', end='')


(n, t) = map(int, input().split())
s = list(input())
while t > 0:
	i = 0
	while i < len(s) - 1:
		if s[i + 1] > s[i]:
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
	t -= 1
print(''.join(s))


t = int(input().split()[1])
queue = input()
for _ in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, time) = [int(i) for i in input().split(' ')]
queue = input()
for t in range(time):
	newQ = ''
	flag = False
	for i in range(len(queue) - 1):
		if flag:
			flag = False
			continue
		if queue[i] == 'B' and queue[i + 1] == 'G':
			newQ += 'GB'
			flag = True
		else:
			newQ += queue[i]
	if queue[-2:] != 'BG':
		newQ += queue[-1]
	queue = newQ
print(queue)


m = list(map(int, input().split()))
(n, t) = (m[0], m[1])
string = list(input())
number = 0
while t != 0:
	number = 0
	while number < n - 1:
		if string[number] == 'B' and string[number + 1] == 'G':
			string[number] = 'G'
			string[number + 1] = 'B'
			number += 1
		number += 1
	t -= 1
print(''.join(string))


import re

def solve(t, st):
	for _ in range(t):
		st = re.sub('BG', 'GB', st)
	return st

def test():
	assert solve(1, 'BGGBG') == 'GBGGB'
	assert solve(2, 'BGGBG') == 'GGBGB'
	assert solve(1, 'GGGB') == 'GGGB'
test()
(n, t) = map(int, input().split())
res = solve(t, input())
print(res)


(n, t) = map(int, input().split())
s = input()
lis = []
a = 0
for _ in s:
	lis.append(_)
for i in range(t):
	for j in range(n - 1):
		if lis[j] == 'B' and lis[j + 1] == 'G' and (a == 0):
			(lis[j], lis[j + 1]) = (lis[j + 1], lis[j])
			a += 1
		else:
			a = 0
	a = 0
print(*lis, sep='')


(n, t) = [int(x) for x in input().split(' ')]
inp_str = input()

def fun(n, t, inp_str):
	for i in range(t):
		new_string = ''
		look_for_girl = False
		for ch in inp_str:
			if ch == 'B':
				if look_for_girl:
					new_string += 'B'
				look_for_girl = True
			elif look_for_girl:
				new_string += 'GB'
				look_for_girl = False
			else:
				new_string += 'G'
		if look_for_girl:
			new_string += 'B'
		inp_str = new_string
	return new_string
print(fun(n, t, inp_str))


(k, t) = map(int, input().split())
s = input()
w = ''
while t:
	t -= 1
	w = s.replace('BG', 'GB')
	s = w
print(w)


(n, t) = [int(i) for i in input().strip().split()]
s = [i for i in input().strip()]
for t0 in range(t):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(s))


n = list(map(int, input().strip().split(' ')))
A = list(input())
L = A.copy()
for i in range(n[1]):
	A = L.copy()
	for i in range(0, n[0] - 1):
		if A[i] == 'B' and A[i + 1] == 'G':
			(L[i], L[i + 1]) = (L[i + 1], L[i])
print(''.join(L))


(a, b) = [int(i) for i in input().split(' ')]
c = [str(i) for i in input()]
i = 0
while i < b:
	j = 0
	while j < len(c) - 1:
		if c[j] == 'B' and c[j + 1] == 'G':
			c[j] = 'G'
			c[j + 1] = 'B'
			j += 2
		else:
			j += 1
	i += 1
f = 0
k = ''
while f < len(c):
	k += c[f]
	f += 1
print(k)


(top, tim) = map(int, input().split())
sira = input()
sira = list(sira)
for _ in range(tim):
	i = 0
	while i + 1 < top:
		if sira[i] == 'B' and sira[i + 1] == 'G':
			tmp = sira[i]
			sira[i] = sira[i + 1]
			sira[i + 1] = tmp
			i += 2
		else:
			i += 1
print(''.join(sira))


def main():
	(n, t) = map(int, input().split())
	q = list(input())
	b_flag = False
	i = 0
	j = 0
	while i < t:
		while j < n:
			if q[j] == 'G':
				if b_flag:
					q[j] = 'B'
					q[j - 1] = 'G'
				b_flag = False
			else:
				b_flag = True
			j += 1
		i += 1
		b_flag = False
		j = 0
	print(''.join(q))
main()


(n, t) = map(int, input().split())
children = list(input())
for _ in range(t):
	swapped = False
	for i in range(n - 1):
		if swapped:
			swapped = False
		elif children[i] == 'B' and children[i + 1] == 'G':
			(children[i], children[i + 1]) = (children[i + 1], children[i])
			swapped = True
print(''.join(children))


import sys
(n, t) = (int(temp) for temp in input().split(' '))
seq = input()
for i in range(t):
	seq = seq.replace('BG', 'GB')
print(seq)


firstL = input().split(' ')
secndL = list(input())
for i in range(int(firstL[1])):
	chck = True
	for j in range(int(firstL[0]) - 1):
		if secndL[j] == 'B' and secndL[j + 1] == 'G' and (chck == True):
			temp = secndL[j]
			secndL[j] = secndL[j + 1]
			secndL[j + 1] = temp
			chck = False
		else:
			chck = True
print(''.join([str(k) for k in secndL]))


(n, t) = input().split()
q = list(input())
for _ in range(int(t)):
	i = 0
	while i < int(n) - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			(q[i], q[i + 1]) = ('G', 'B')
			i += 1
		i += 1
a = ''
for c in q:
	a += c
print(a)


first_input = input()
(n, t) = first_input.split(' ')
number_of_students = int(n)
no_of_times = int(t)
x = 0
answer = list(input())
for o in range(no_of_times):
	x = 0
	for o in range(number_of_students):
		while x < number_of_students - 1:
			if answer[x] == 'B' and answer[x + 1] == 'G':
				previous_value = answer[x]
				previous_value_1 = answer[x + 1]
				answer[x] = previous_value_1
				answer[x + 1] = previous_value
				x = x + 2
			else:
				x = x + 1

def listToString(s):
	str1 = ''
	return str1.join(s)
str2 = listToString(answer)
str3 = str2.strip()
print(str3)


(n, t) = map(int, input().split())
ar = list(input())
for j in range(t):
	i = 0
	while i != len(ar):
		if i == len(ar) - 1:
			break
		if ar[i] == 'B' and ar[i + 1] == 'G':
			ar[i] = 'G'
			ar[i + 1] = 'B'
			i += 1
		i += 1
for nn in range(len(ar)):
	print(ar[nn], end='')


(a, b) = map(int, input().split())
n = input()
c = list(n)
for j in range(b):
	i = 0
	while i < a - 1:
		if c[i] == 'B' and c[i + 1] == 'G':
			c[i] = 'G'
			c[i + 1] = 'B'
			i += 1
		i += 1
print(*c, sep='')


import sys

def shiftBOverG(queue):
	oldQueue = list(queue)
	queue = list(queue)
	for i in reversed(range(1, len(queue))):
		if oldQueue[i] > oldQueue[i - 1]:
			queue[i] = oldQueue[i - 1]
			queue[i - 1] = oldQueue[i]
	return ''.join(queue)
(n, t) = map(int, input().split(' '))
queue = input().strip()
for i in range(0, t):
	queue = shiftBOverG(queue)
print(queue)


(n, t) = input('').split()
number_on_queue = int(n)
seconds = int(t)
queue = input('')
queue_list = []
for i in queue:
	queue_list.append(i)

def check_queue(queue):
	qu = True
	for i in queue:
		if i != 'B' and i != 'G':
			print(i)
			qu = False
	return qu

def order_queue_once(queue):
	new_queue = []
	i = 0
	while i < len(queue):
		if number_on_queue == 1:
			new_queue.insert(i, queue[i])
			break
		if queue[i] == 'B' and i < number_on_queue - 1 and (queue[i + 1] == 'G'):
			new_queue.insert(i, 'G')
			new_queue.insert(i + 1, 'B')
			i += 1
		elif queue[i] == 'B' and i < number_on_queue - 1 and (queue[i + 1] == 'B'):
			new_queue.insert(i, 'B')
		elif queue[i] == 'G' and queue[i - 1] == 'G' and (i >= 1):
			new_queue.insert(i, 'G')
		elif queue[i] == 'G' and i < number_on_queue - 1 and (queue[i + 1] == 'G'):
			new_queue.insert(i, 'G')
		elif queue[i] == 'G' and i < number_on_queue - 1 and (queue[i + 1] == 'B'):
			new_queue.insert(i, 'G')
		elif queue[i] == 'B' and i == number_on_queue - 1:
			new_queue.insert(i, 'B')
		i += 1
	return new_queue
if 1 <= number_on_queue and 1 <= seconds and (number_on_queue <= 50) and (seconds <= 50) and check_queue(queue):
	tmp_queue = queue_list
	i = 1
	while i <= seconds:
		i += 1
		tmp_queue1 = order_queue_once(tmp_queue)
		tmp_queue = tmp_queue1
	for i in tmp_queue:
		print(i, end='')


n = input().split()
n = [int(i) for i in n]
s = input()
s = [str(j) for j in s]
e = 0
while e < n[1]:
	i = 0
	while i <= n[0] - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
	e += 1
print(''.join(s))


__author__ = 'widoc'
(n, t) = map(int, input().split())
s = input()
deq = []
for i in range(n):
	if s[i] == 'B':
		deq.append(1)
	else:
		deq.append(2)
for i in range(t):
	flag = False
	for x in range(n - 1, 0, -1):
		if flag:
			flag = False
			continue
		if deq[x] == 2 and deq[x - 1] == 1:
			(deq[x - 1], deq[x]) = (deq[x], deq[x - 1])
			flag = True
res = ''
for i in range(n):
	if deq[i] == 1:
		res += 'B'
	else:
		res += 'G'
print(res)


(l, t) = map(int, input().split())
seq = input()
for _ in range(t):
	seq = seq.replace('BG', 'GB')
print(seq)


(n, t) = list(map(int, input().split()))
s = input()
l = []
group = []
count = 1
k = 0
for i in range(n):
	l.append(s[i])
for i in range(t):
	for j in range(1, n):
		if l[j - 1].isalpha() and l[j] > l[j - 1]:
			l[j] = '1'
			l[j - 1] = 'G'
	for k in range(len(l)):
		if l[k] == '1':
			l[k] = 'B'
print(''.join(l))


(num, t) = input().split()
num = int(num)
t = int(t)
a = input()
m = [a[p] for p in range(len(a))]
new = m.copy()
for i in range(t):
	for j in range(num - 1):
		if m[j] == 'B' and m[j + 1] == 'G':
			new[j] = 'G'
			new[j + 1] = 'B'
		else:
			continue
	m = new.copy()
for h in range(len(new)):
	print(new[h], end='')


(n, k) = map(int, input().split())
s = input()
while k > 0:
	if 'BG' in s:
		s = s.replace('BG', 'GB')
	k -= 1
print(s)


inp = input().split()
inp2 = input()
a = int(inp[1])
l = []
first_pos = 0
second_pos = 1
for letter in inp2:
	l.append(letter)
for num in range(a):
	while second_pos <= len(l) - 1:
		if l[first_pos] == 'B':
			if l[second_pos] == 'G':
				l[first_pos] = 'G'
				l[second_pos] = 'B'
				first_pos += 2
				second_pos += 2
			else:
				first_pos += 1
				second_pos += 1
		else:
			first_pos += 1
			second_pos += 1
	first_pos = 0
	second_pos = 1
e = ''
for char in l:
	e += char
print(e)


(m, n) = map(int, input().split(' '))
queue = str(input())
if queue == 'BG':
	print('GB')
else:
	for i in range(n):
		if 'GB' in queue:
			queue = queue.replace('BG', 'GB')
	print(queue)


from sys import stdin

def main():
	n = [int(x) for x in stdin.readline().split()]
	x = stdin.readline().strip()
	for i in range(n[1]):
		x = x.replace('BG', 'GB')
	print(x)
main()


str1 = input()
str2 = input()
n = int(str1.split()[0])
k = int(str1.split()[1])
list1 = list(str2)
list1 = list(map(str, list1))
i = 0
l = 0
str3 = 'a'
while i < k:
	while l < n - 1:
		prestr = str(list1[l])
		poststr = str(list1[l + 1])
		if prestr == 'B' and poststr == 'G':
			list1[l] = 'G'
			list1[l + 1] = 'B'
			l = l + 2
		else:
			l = l + 1
	l = 0
	i = i + 1
for g in list1:
	str3 = str3 + g
print(str3[1:])


N = [int(x) for x in input().split()]
queue = input()
a = []
b = []
for i in range(0, N[0]):
	a.append(queue[i])
	b.append(queue[i])
for i in range(0, N[1]):
	for j in range(0, N[0] - 1):
		if a[j] == 'B' and a[j + 1] == 'G':
			b[j] = 'G'
			b[j + 1] = 'B'
	for j in range(0, N[0]):
		a[j] = b[j]
print(''.join(a))


(n, t) = map(int, input().split())
l = list(input())
for j in range(t):
	skip_exchange = False
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G' and (not skip_exchange):
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			skip_exchange = True
		else:
			skip_exchange = False
for i in l:
	print(i, sep='', end='')


(x, y) = map(int, input().split())
z = input()
a = [i for i in z]
i = 0
while i < y:
	j = 0
	while j < x - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			t = a[j]
			a[j] = a[j + 1]
			a[j + 1] = t
			j += 2
		else:
			j += 1
	i += 1
print(''.join(a))


def xx(s, t):
	s = list(s)
	for x in range(t):
		d = []
		for (index, letter) in enumerate(s):
			try:
				if letter == 'B' and s[index + 1] == 'G':
					d.append(index)
			except:
				if IndexError:
					pass
		for x in d:
			if s[x + 1] == 'G':
				del s[x]
				s.insert(x + 1, 'B')
		s = s
	return ''.join(s)
(n, t) = map(int, input().split())
s = input()
print(xx(s, t))


temp = input().split(' ')
n = int(temp[0])
t = int(temp[1])
temp = input()
queue = list()
for i in range(0, n):
	queue.extend(temp[i])
temp = queue
for i in range(0, t):
	queue = list()
	for j in range(0, n):
		if j > 0 and temp[j] == 'G' and (temp[j - 1] == 'B'):
			queue.pop()
			queue.extend('G')
			queue.extend('B')
		else:
			queue.extend(temp[j])
	temp = queue
for i in temp:
	print(i, end='')


(n, x) = map(int, input().split())
str1 = list(input())
for j in range(x):
	i = 0
	while i < n - 1:
		if str1[i] == 'B' and str1[i + 1] == 'G':
			str1[i] = 'G'
			str1[i + 1] = 'B'
			i = i + 1
		i = i + 1
str1 = ''.join(str1)
print(str1)


(n, t) = map(int, input().split())
l = input()
for j in range(1, t + 1):
	k = l.find('BG')
	while k != -1:
		l = l[:k] + 'GB' + l[k + 2:]
		k = l.find('BG', k + 2)
print(l)


def solve(queue, x):
	modded = list(queue)
	for j in range(x):
		for i in range(len(queue) - 1):
			if list(queue)[i] == 'B' and list(queue)[i + 1] == 'G':
				temp = modded[i]
				modded[i] = modded[i + 1]
				modded[i + 1] = temp
		queue = ''.join(modded)
	print(''.join(modded))
testcases = 1
for i in range(testcases):
	(n, x) = list(map(int, input().split()))
	queue = input()
	solve(queue, x)


(x, y) = input().split()
x = int(x)
y = int(y)
c = input()
d = []
b = ''
for i in c:
	d.append(i)
while y > 0:
	i = 0
	while i < len(d) - 1:
		if d[i] == 'B' and d[i + 1] == 'G':
			(d[i], d[i + 1]) = (d[i + 1], d[i])
			i += 1
		i += 1
	y -= 1
for i in range(len(d)):
	b += d[i]
print(b)


(n, t) = map(int, input().split())
a = list(input())
for k in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
print(*a, sep='')


(l, t) = map(int, input().split())
str1 = str(input())
x = 0
i = str1.count('G')
while x < t:
	x += 1
	list1 = []
	for a in range(i):
		list1.append('G')
	for a in range(l):
		if a < l - 1:
			if str1[a] == 'B' and str1[a + 1] == 'G':
				list1.insert(a + 1, 'B')
			if str1[a] == 'B' and str1[a + 1] == 'B':
				list1.insert(a, 'B')
				if a == l - 2:
					list1.append('B')
			if a == l - 2 and str1[a] == 'G' and (str1[a + 1] == 'B'):
				list1.append('B')
		if l == 1:
			list1 = [str1]
	str1 = ''.join(list1)
print(str1)


(n, t) = input().split()
n = int(n)
t = int(t)
a = input()
a += 'B'
l = list(a)
l1 = list(a)
for j in range(t):
	for i in range(n):
		if l[i] == 'B' and l[i + 1] == 'G':
			l1[i] = 'G'
			l1[i + 1] = 'B'
	l = []
	for i in l1:
		l.append(i)
a = ''
for i in range(n):
	a += l[i]
print(a)


(n, m) = map(int, input().split())
s = input()
for f in range(m):
	s = s.replace('BG', 'GB')
print(s)


nt = input().split()
(n, t) = (int(nt[0]), int(nt[1]))
order = input()

def switch(word, i1, i2):
	wordLst = list(word)
	(v1, v2) = (wordLst[i1], wordLst[i2])
	wordLst[i1] = v2
	wordLst[i2] = v1
	return ''.join(wordLst)

def getBIndexs():
	indexs.clear()
	for i in range(len(order)):
		if order[i] == 'B':
			indexs.append(i)
indexs = []
for i in range(t):
	getBIndexs()
	for v in indexs:
		try:
			if order[v] != order[v + 1]:
				order = switch(order, v, v + 1)
		except:
			pass
print(order)


(n, t) = map(int, input().split())
s = input()
while t > 0:
	a = ''
	i = 0
	while i < len(s):
		if s[i] == 'B' and i == len(s) - 1:
			a = a + s[i]
			i = i + 1
		elif s[i] == 'B' and s[i + 1] == 'G':
			a = a + 'GB'
			i = i + 2
		else:
			a = a + s[i]
			i = i + 1
	s = a
	t = t - 1
print(s)


import math
s = input().split()
a = int(s[0])
b = int(s[1])
an = input()
for k in range(b):
	i = 0
	s = ''
	while i < a - 1:
		if an[i] == 'B' and an[i + 1] == 'G':
			s += 'GB'
			i += 2
		else:
			s += an[i]
			i += 1
	if len(s) != a:
		s += an[-1]
	an = s
print(s)


(n, t) = (int(i) for i in input().split())
a = input()
b = list(a)
for i in range(0, t):
	carry = [0 for i in range(n)]
	for j in range(0, n - 1):
		if b[j] == 'B' and b[j + 1] == 'G' and (carry[j] == 0) and (carry[j + 1] == 0):
			k = b[j]
			b[j] = b[j + 1]
			b[j + 1] = k
			carry[j] = 1
			carry[j + 1] = 1
print(''.join(b))


nums = list(map(int, input().split()))
s = list(str(input()))
for i in range(nums[1]):
	j = 0
	while j < nums[0] - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 2
		else:
			j += 1
print(''.join(s))


from sys import stdin
(n, t) = [int(x) for x in stdin.readline().split()]
s = [x for x in stdin.readline()]
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(s))


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
from math import ceil
(n, t) = ei()
s = [i for i in input()]
for i in range(t):
	x = set()
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G' and (j not in x) and (j + 1 not in x):
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			x.add(j)
			x.add(j + 1)
print(''.join(s))


(n, t) = map(int, input().split())
a = list(input())
for i in range(t):
	k = 0
	while k < len(a) - 1:
		if a[k] == 'B' and a[k + 1] == 'G':
			a[k] = 'G'
			a[k + 1] = 'B'
			k += 1
		k += 1
for q in range(len(a)):
	print(a[q], end='')


(s, t) = map(int, input().split())
l = list(str(input()))
for i in range(t):
	sp = []
	for y in range(s):
		if l[y] == 'G':
			sp.append('G')
		elif l[y] == 'B':
			try:
				if l[y + 1] == 'G':
					sp.append('G')
					sp.append('B')
					l[y + 1] = '0'
				else:
					sp.append(l[y])
			except:
				sp.append('B')
		else:
			pass
	l = [x for x in sp]
print(''.join(l))


(n, t) = map(int, input().split())
li = list(input())
for i in range(t):
	b = 0
	for m in range(n - 1):
		if b == 1:
			b = 0
			continue
		if li[m] < li[m + 1]:
			a = li[m]
			li[m] = li[m + 1]
			li[m + 1] = a
			b = 1
print(''.join(li))


import re
(n, t) = [int(x) for x in input().split()]
q = list(input())
for i in range(t):
	indices = [index.start() for index in re.finditer('BG', ''.join(q))]
	if len(indices) == 0:
		break
	for index in indices:
		q[index] = 'G'
		q[index + 1] = 'B'
print(''.join(q))


(x, y) = input().split()
(n_child, n_time) = [int(x), int(y)]
queue = str(input())
list_queue = list(queue)
for i in range(n_time):
	j = 1
	while j in range(len(list_queue)):
		if (list_queue[j] == 'G') & (list_queue[j - 1] == 'B'):
			swap = list_queue[j]
			list_queue[j] = list_queue[j - 1]
			list_queue[j - 1] = swap
			j += 2
		else:
			j += 1
final_queue = ''.join(list_queue)
print(final_queue)


s = [int(i) for i in input().split()]
s_line = [i for i in input()]
no_students = s[0]
time = s[1]
s1 = []
for i in range(no_students):
	s1.append(s_line[i])
for i in range(time):
	j = 0
	while j < len(s1) - 1:
		if s1[j] == 'B' and s1[j + 1] == 'G':
			temp = s1[j]
			s1[j] = s1[j + 1]
			s1[j + 1] = temp
			j += 1
		j += 1
print(''.join(s1))


nt = input().split(' ')
(n, t) = [int(x) for x in nt]
bgs = list(input())
bs = [i for (i, c) in enumerate(bgs) if c == 'B']
for j in range(t):
	i = 0
	while i < n - 1:
		if bgs[i] == 'B' and bgs[i + 1] == 'G':
			bgs[i] = 'G'
			bgs[i + 1] = 'B'
			i += 1
		i += 1
bgs = ''.join(bgs)
print(bgs)


line = []
for i in range(2):
	a = input()
	line.append(a)
s1 = line[0].split()
n = int(s1[0])
t = int(s1[1])
Q = list(line[1])
for j in range(t):
	a = []
	for i in range(n - 1):
		if Q[i] == 'B' and Q[i + 1] == 'G':
			a.append(i)
	for k in range(len(a)):
		(Q[a[k]], Q[a[k] + 1]) = (Q[a[k] + 1], Q[a[k]])
	if len(a) == 0:
		break
str1 = ''.join(Q)
print(str1)


(n, t) = list(map(int, input().split()))
queue = input()
output_queue = queue
mark = {}
for j in range(n):
	mark[j] = False
for i in range(t):
	queue = output_queue
	output_queue = ''
	mark = mark.fromkeys(mark, False)
	for j in range(n):
		if queue[j] == 'B' and j + 1 < n and (queue[j + 1] == 'G'):
			output_queue += 'G'
			output_queue += 'B'
			mark[j] = True
			mark[j + 1] = True
		elif not mark[j]:
			output_queue += queue[j]
print(output_queue)


(n, t) = input().split()
n = int(n)
t = int(t)
s = [str(x) for x in input()]
T = 1
while T <= t:
	i = 1
	while i < len(s):
		if s[-i] == 'G' and s[-i - 1] == 'B':
			s[-i] = 'B'
			s[-i - 1] = 'G'
			i += 2
		else:
			i += 1
	T += 1
print(''.join(s))


nt = tuple(map(int, input().split()))
arr = [a for a in input()]
for i in range(nt[1]):
	skip = False
	for j in range(nt[0] - 1):
		if skip == True:
			skip = False
			continue
		if arr[j] == 'B' and arr[j + 1] == 'G':
			t = arr[j]
			arr[j] = arr[j + 1]
			arr[j + 1] = t
			skip = True
print(''.join(arr))


(n, t) = list(map(int, input().split()))
q = list(input())
for x in range(t):
	k = 0
	while k < n - 1:
		if q[k] < q[k + 1]:
			q.pop(k)
			q.insert(k + 1, 'B')
			k += 2
		else:
			k += 1
p = ''.join(q)
print(p)


(n, t) = [int(i) for i in input().split()]
s = input()
queue = list(s)
for k in range(t):
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
s = ''.join(queue)
print(s)


(n, sec) = map(int, input().split())
queue = input()
arr = []
for i in queue:
	if i == 'G':
		arr.append(0)
	else:
		arr.append(1)
i = 0
for j in range(sec):
	i = 0
	while i < n - 1:
		if arr[i] == 1 and arr[i + 1] == 0:
			arr[i] = 0
			arr[i + 1] = 1
			i += 2
		else:
			i += 1
queue = ''
for i in arr:
	if i == 1:
		queue += 'B'
	else:
		queue += 'G'
print(queue)


(n, t) = map(int, input().split())
A = list(str(input()))
ans = A.copy()
copy = A.copy()
for ii in range(t):
	for i in range(1, n):
		if copy[i] == 'G' and copy[i - 1] == 'B':
			ans[i] = 'B'
			ans[i - 1] = 'G'
	copy = ans.copy()
print(''.join(ans))


(l, k) = map(int, input().split())
n = input()
s1 = 'BG'
s2 = 'GB'
for i in range(0, k):
	n = n.replace(s1, s2)
print(n)


(n, t) = [int(x) for x in input().split()]
queue = list(input())
for tempo in range(t):
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
for x in queue:
	print(x, end='')
print()


(n, t) = map(int, input().split())
string = input()
s = []
for i in string:
	s.append(i)
for i in range(t):
	f = 0
	for j in range(len(s) - 1):
		if f == 1:
			f = 0
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			f = 1
for i in s:
	print(i, end='')


(n, t) = list(map(int, input().split()))
queue = input()
for steps in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, t) = map(int, input().rstrip().split())
s = input()
s1 = list(s)
for i in range(t):
	j = 0
	while j < len(s) - 1:
		if s1[j] == 'B' and s1[j + 1] == 'G':
			(s1[j], s1[j + 1]) = (s1[j + 1], s1[j])
			j += 1
		j += 1
for i in s1:
	print(i, end='')


(n, t) = map(int, input().split())
l = list(input())
a = l.copy()
for x in range(t):
	for y in range(n - 1):
		if l[y] == 'B' and l[y + 1] == 'G':
			a[y] = 'G'
			a[y + 1] = 'B'
	l = a.copy()
print(''.join(a))


(n, t) = map(int, input().split())
s1 = input()
s2 = ''
for i in range(t):
	j = 0
	while j < len(s1):
		if j == len(s1) - 1:
			s2 += s1[j]
			j += 1
		elif s1[j:j + 2] == 'BG':
			s2 += 'GB'
			j += 2
		else:
			s2 += s1[j]
			j += 1
	s1 = s2
	s2 = ''
print(s1)


import sys

def swap(queue, i):
	temp = queue[int(i)]
	queue[int(i)] = queue[int(i) + 1]
	queue[int(i) + 1] = temp
(n, t) = [int(x) for x in input().split()]
queue = [x for x in input()]
for x in range(t):
	i = int(0)
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			swap(queue, i)
		else:
			i -= 1
		i += 2
for x in queue:
	sys.stdout.write(x)
print()


(n, t) = map(int, input().split())
text = list(input())
for p in range(0, t):
	i = 0
	while i < n - 1:
		if text[i] == 'B' and text[i + 1] == 'G':
			a = text[i]
			text[i] = text[i + 1]
			text[i + 1] = a
			i += 2
		else:
			i += 1
print(*text, sep='')


s = int(input().split()[1])
str_in = input()
for _ in range(s):
	str_in = str_in.replace('BG', 'GB')
print(str_in)


(n, t) = map(int, input().split())
s = list(str(input()))
for j in range(t):
	wasDone = False
	for i in range(n):
		if i != n - 1:
			if wasDone:
				wasDone = False
			elif s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				wasDone = True
print(''.join(s))


(length, seconds) = map(int, input().split())
string = list(input())
copy = ''
counter = 1
for x in range(seconds):
	while counter < length:
		if string[counter] == 'G' and string[counter - 1] == 'B':
			(string[counter], string[counter - 1]) = ('B', 'G')
			counter += 2
		else:
			counter += 1
	counter = 1
print(*string, sep='')


def c(val):
	temp = val
	sol = []
	for i in range(len(temp) - 1):
		if temp[i] == 'B' and temp[i + 1] == 'G':
			sol.append(i + 1)
	return sol
(n, t) = map(int, input().split(' '))
values = list(str(input()))
ans = ''
for i in range(t):
	l = c(values)
	for j in l:
		(values[j - 1], values[j]) = (values[j], values[j - 1])
for i in values:
	ans = ans + i
print(ans)


import sys

def solve():
	(n_students, time) = map(int, sys.stdin.readline().split())
	students = list(sys.stdin.readline())
	for _ in range(time):
		swap_table = [False] * len(students)
		for i in range(len(students), 0, -1):
			if students[i - 1] == 'B' and students[i] == 'G' and (not swap_table[i]) and (not swap_table[i - 1]):
				(students[i - 1], students[i]) = (students[i], students[i - 1])
				swap_table[i] = True
				swap_table[i - 1] = True
	sys.stdout.write(''.join(students))
solve()


(n, t) = [int(x) for x in input().split()]
queue = input()
l = list()
for each in queue:
	l.append(each)
for i in range(t):
	j = 0
	while j < n - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			l[j] = 'G'
			l[j + 1] = 'B'
			j += 1
		j += 1
for each in l:
	print(each, end='')


(num, time) = list(map(int, input().split()))
queue = input()

def splitter(string):
	arg2 = []
	for char in string:
		arg2.append(char)
	return arg2

def gatherer(theList, length):
	Arg2 = str()
	for l in range(length):
		Arg2 += theList[l]
	return Arg2
Que = splitter(queue)
for i in range(time):
	k = 0
	for j in queue:
		if j == 'B' and k != num - 1:
			(Que[k], Que[k + 1]) = (Que[k + 1], Que[k])
		k += 1
	queue = gatherer(Que, num)
result = gatherer(Que, num)
print(result)


(N, Q) = map(int, input().split())
queue = str(input())
que = list(queue)
for _ in range(Q):
	i = 0
	while i < N - 1:
		if que[i] == 'B' and que[i + 1] == 'G':
			(que[i], que[i + 1]) = (que[i + 1], que[i])
			i += 1
		i += 1
print(''.join(que))


a = list(map(int, input().split(' ')))
s = list(input())
for j in range(a[1]):
	x = 0
	while x < len(s) - 1:
		if s[x] == 'B' and s[x + 1] == 'G':
			(s[x], s[x + 1]) = (s[x + 1], s[x])
			x += 2
		else:
			x += 1
ans = ''
for i in s:
	ans += i
print(ans)


(_, secs) = list(map(int, input().split()))
queue = list(input())
temp_queue = queue.copy()
for _ in range(secs):
	for idx in range(len(queue) - 1):
		if temp_queue[idx] == 'B' and temp_queue[idx + 1] == 'G':
			(queue[idx], queue[idx + 1]) = (queue[idx + 1], queue[idx])
	temp_queue = queue.copy()
print(''.join(queue))


a = [int(i) for i in input().split()]
n = a[0]
t = a[1]
s = str(input())
if 'BG' in s:
	while t != 0:
		s = s.replace('BG', 'GB')
		t = t - 1
print(s)


def swap(s, n):
	temp = s[n]
	s[n] = s[n + 1]
	s[n + 1] = temp
	return s
(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	j = 0
	while j < len(s) - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s = swap(s, j)
			j = j + 1
		j = j + 1
print(''.join(s))


(size, time) = map(int, input().split())
queue = list(input())
while time > 0:
	i = 0
	while i < size - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 1
		i += 1
	time -= 1
for char in queue:
	print(char, end='')


nAndTStr = input()
n = int(nAndTStr.split()[0])
t = int(nAndTStr.split()[1])
que = input()

def shift1Second(theQue):
	queque = list(theQue)
	jump = False
	for i in range(n):
		if queque[i] == 'G' and i > 0:
			if queque[i - 1] == 'B' and (not jump):
				queque[i] = 'B'
				queque[i - 1] = 'G'
				jump = True
		else:
			jump = False
	return ''.join(queque)
for i in range(t):
	que = shift1Second(que)
print(que)


l = [int(k) for k in input().split(' ')]
(n, t) = (l[0], l[1])
s = [input()]
for i in range(t):
	s[0] = s[0].replace('BG', 'GB')
print(s[0])


(n, t) = list(map(int, input().split()))
l = list(input())
for j in range(t):
	i = 0
	while i <= len(l) - 1:
		if l[i] == 'B':
			if i + 1 < len(l):
				if l[i + 1] == 'G':
					(l[i + 1], l[i]) = (l[i], l[i + 1])
					i += 1
		i += 1
for i in l:
	print(i, end='')


(n, t) = input().split()
temp = input()
s = []
answer = ''
for i in range(int(n)):
	s.append(temp[i])
for i in range(int(t)):
	boys_index = []
	for j in range(len(s) - 1):
		if s[j] == 'B':
			boys_index.append(j)
	for j in range(len(boys_index)):
		if boys_index[j] != int(n) - 1:
			tmp = s[boys_index[j]]
			s[boys_index[j]] = s[boys_index[j] + 1]
			s[boys_index[j] + 1] = tmp
for i in s:
	answer += i
print(answer)


(n, t) = [int(x) for x in input().split()]
fila = input()
lista = []
for e in fila:
	lista.append(e)
while t > 0:
	trocou = False
	for i in range(len(lista) - 2, -1, -1):
		if trocou:
			trocou = False
			continue
		if lista[i] == 'B' and lista[i + 1] == 'G':
			(lista[i], lista[i + 1]) = (lista[i + 1], lista[i])
			trocou = True
	t -= 1
print(''.join(lista))


(a, t) = list(map(int, input().split()))
n = list(input())
for g in range(t):
	i = 0
	while i < a - 1:
		if n[i] == 'B' and n[i + 1] == 'G':
			(n[i], n[i + 1]) = (n[i + 1], n[i])
			i += 1
		i += 1
print(''.join(n))


ar = []
for i in input().split():
	ar.append(int(i))
temp = list(input())
for j in range(ar[1]):
	temp2 = temp.copy()
	for i in range(1, ar[0]):
		if temp[i] == 'G' and temp[i - 1] == 'B':
			temp2[i] = 'B'
			temp2[i - 1] = 'G'
	temp = temp2.copy()
print(''.join((str(i) for i in temp)))


(n, t) = input().split()
seq = list(input())
for i in range(int(t)):
	switchs = []
	for j in range(int(n) - 1):
		if seq[j] == 'B' and seq[j + 1] == 'G':
			switchs.append(j)
	for switch in switchs:
		(seq[switch], seq[switch + 1]) = (seq[switch + 1], seq[switch])
print(''.join(seq))


(n, k) = map(int, input().split(' '))
A = []
X = list(input())
for j in range(k):
	for i in range(1, n):
		if X[i - 1] == 'B' and X[i] == 'G':
			A.append(i - 1)
	for j in range(len(A)):
		X[A[j]] = 'G'
		X[A[j] + 1] = 'B'
print(''.join((str(v) for v in X)))


(n, t) = [int(i) for i in input().split()]
s = input()
lst = list(s)
while t:
	t -= 1
	i = 0
	while i + 1 <= len(lst) - 1:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			lst[i] = 'G'
			lst[i + 1] = 'B'
			i += 2
		else:
			i += 1
s1 = ''
for i in range(len(lst)):
	s1 += lst[i]
print(s1)


(n, t) = map(int, input().split())
l = list(input())
for i in range(t):
	temp = list(l)
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			(temp[i], temp[i + 1]) = ('G', 'B')
	l = temp
print(''.join(l))


(n, t) = list(map(int, input().split()))
order = list(input())
for i in range(t):
	k = 0
	while k < n - 1:
		if order[k] == 'B' and order[k + 1] == 'G':
			(order[k], order[k + 1]) = (order[k + 1], order[k])
			k += 2
		else:
			k += 1
print(''.join(order))


col = input().split()
n = int(col[0])
t = int(col[1])
s = input()
h = 0
while h < t:
	if 'BG' in s:
		s = s.replace('BG', 'GB')
	h += 1
print(s)


s = input().split()
n = int(s[0])
t = int(s[1])
lst = list(input())
i = 0
k = 0
lst1 = []
while i < t:
	while k <= n - 1:
		if k != n - 1:
			if lst[k] == 'B':
				if lst[k + 1] == 'G':
					lst1.append('G')
					lst1.append('B')
					k += 2
				else:
					lst1.append(lst[k])
					k += 1
			else:
				lst1.append(lst[k])
				k += 1
		else:
			lst1.append(lst[k])
			k += 1
	lst = lst1
	lst1 = []
	k = 0
	i += 1
print(''.join(lst))


(n, t) = input().split()
n = int(n)
t = int(t)
s = list(input())
i = 0
while t > 0:
	while i + 1 < n:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
	t -= 1
	i = 0
j = 0
while j < n:
	print(s[j], end='')
	j += 1


(n, t) = list(map(int, input().split()))
s = input()
li = list(s)
for i in range(t):
	j = 0
	while j < n - 1:
		if li[j] == 'B' and li[j + 1] == 'G':
			(li[j], li[j + 1]) = ('G', 'B')
			j += 2
		else:
			j += 1
s = ''.join([str(ele) for ele in li])
print(s)


(n, k) = map(int, input().split(' '))
s = input()
for _ in range(k):
	i = 0
	while i < n:
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			s = s[:i] + 'GB' + s[i + 2:]
			i += 2
		else:
			i += 1
print(s)


a = list(map(int, input().split()))
n = a[0]
k = a[1]
s = list(input())
while k > 0:
	k -= 1
	i = 1
	while i < len(s):
		if s[i - 1] + s[i] == 'BG':
			s[i - 1] = 'G'
			s[i] = 'B'
			i += 1
		i += 1
s1 = ''
print(s1.join(s))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))

def solve(q, t):
	for i in range(t):
		j = 0
		while j < len(q) - 1:
			if q[j] == 'B' and q[j + 1] == 'G':
				(q[j], q[j + 1]) = (q[j + 1], q[j])
				j += 1
			j += 1
	return q
f = invr()
q = insr()
print(''.join(solve(q, f[1])))


import sys
import math
from collections import *

def get_ints():
	return map(int, input().split())

def get_list():
	return list(get_ints())

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
MODPRIME = int(1000000000.0 + 7)
BABYMODPR = 998244353
MAXN = int(100000.0)
(n, t) = get_ints()
s = list(input())
while 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 += 1
		i += 1
	t -= 1
print(''.join(s))


import sys
(line_length, time) = map(int, sys.stdin.readline().split())
input_line = sys.stdin.readline()
current_pos = 0
boys_positions = []
for c in input_line:
	if c == 'B':
		boys_positions.append(current_pos)
	current_pos += 1
boys_count = len(boys_positions)
for t in range(time):
	for k in range(boys_count - 1):
		if boys_positions[k] < boys_positions[k + 1] - 1:
			boys_positions[k] += 1
	if boys_count > 0 and boys_positions[boys_count - 1] < line_length - 1:
		boys_positions[boys_count - 1] += 1
if boys_count == 0:
	substrings = ['G' * line_length]
else:
	substrings = ['G' * boys_positions[0] + 'B']
	for k in range(boys_count - 1):
		substrings.append('G' * (boys_positions[k + 1] - boys_positions[k] - 1) + 'B')
	if boys_positions[boys_count - 1] < line_length - 1:
		substrings.append('G' * (line_length - 1 - boys_positions[boys_count - 1]))
print(*substrings, sep='')


(n, t) = map(int, input().split())
s = input()
for tem in range(0, t):
	s2 = ''
	cont = 0
	while cont < n - 1:
		if s[cont] == 'B' and s[cont + 1] == 'G':
			s2 += 'GB'
			cont += 2
		else:
			s2 += s[cont]
			cont += 1
	if cont == n - 1:
		s2 += s[-1]
	s = s2
print(s2)


(l, t) = map(int, input().split())
s = input()
s = list(s)
for _ in range(t):
	indices = [i for (i, x) in enumerate(s) if x == 'B']
	for i in indices:
		if i != l - 1 and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
	indices.clear()
print(''.join(s))


(n, time) = map(int, input().split())
position = list(input())
t = 0
while t < time:
	tt = 0
	while tt < n:
		if tt + 1 == n:
			break
		if position[tt] == 'B' and position[tt + 1] == 'G':
			position[tt] = 'G'
			position[tt + 1] = 'B'
			tt = tt + 2
		else:
			tt = tt + 1
	t = t + 1
output = ''.join(position)
print(output)


(N, t) = map(int, input().split())
S = input()
List = []
for i in S:
	List.append(i)
while t:
	i = 0
	while i < N - 1:
		if List[i] == 'B' and List[i + 1] == 'G':
			List[i] = 'G'
			List[i + 1] = 'B'
			i += 2
		else:
			i += 1
	t -= 1
print(''.join(List))


(n, t) = [int(i) for i in input().split()]
s = input()
a = []
b = []
for i in s:
	a.append(i)
	b.append(i)
for j in range(t):
	for i in range(n - 1):
		if a[i + 1] == 'G' and a[i] == 'B':
			(b[i + 1], b[i]) = ('B', 'G')
	a = []
	for x in b:
		a.append(x)
for i in b:
	print(i, end='')


a = input()
b = input()
a = a.split(' ')
kol = a[0]
raz = a[1]
z = []
y = 0
for i in range(len(b)):
	z.append(b[i])
for i in range(int(raz)):
	y = 0
	for gu in range(int(kol) - 1):
		if z[gu] == 'B' and z[gu + 1] == 'G' and (y == 0):
			z[gu] = 'G'
			z[gu + 1] = 'B'
			y = 1
		else:
			y = 0
print(''.join(z))


(Children, Time) = input().split()
Queue = input()
Children = int(Children)
Time = int(Time)
for s in range(Time):
	NextQueue = ''
	c = 0
	while c < Children:
		if c != Children - 1 and Queue[c] == 'B' and (Queue[c + 1] == 'G'):
			NextQueue += 'GB'
			c += 1
		else:
			NextQueue += Queue[c]
		c += 1
	Queue = NextQueue
print(Queue)


(n, t) = map(int, input().split())
a = input()
count = 0
while count < t:
	import re
	b = re.sub('BG', 'GB', a)
	a = b
	count = count + 1
print(a)


(n, t) = [int(i) for i in input().split()]
q = input() + 'q'
for j in range(t):
	check = 0
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q = q[:i] + 'GB' + q[i + 2:]
			check = 1
			i += 1
		i += 1
	if not check:
		break
print(q[:-1])


(n, t) = tuple(map(int, input().split()))
s1 = input()
s = []
for tn in s1:
	s.append(tn)
for lgc in range(t):
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
for i in s:
	print(i, end='')


(n, t) = input().split()
(n, t) = (int(n), int(t))
a = list(input())
for i in range(t):
	s = 1
	for j in range(n):
		j += s
		if j < n and j - 1 >= 0:
			if a[j - 1] < a[j]:
				s += 1
				(a[j - 1], a[j]) = (a[j], a[j - 1])
		else:
			s -= 1
print(*a, sep='')


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
	if 'BG' not in s:
		break
print(s)


from sys import stdin
(n, t) = [int(x) for x in stdin.readline().strip().split()]
queue = [x for x in stdin.readline().strip()]
(i, changes) = (0, True)
while changes and i < t:
	(changes, j) = (False, 1)
	while j < n:
		if queue[j - 1] == 'B' and queue[j] == 'G':
			(queue[j - 1], queue[j], changes, j) = ('G', 'B', True, j + 1)
		j += 1
	i += 1
print(''.join(queue))


def f(fila):
	a = 0
	nuevo = ''
	while a < len(fila):
		actual = fila[a]
		if actual == 'B' and a != len(fila) - 1 and (fila[a + 1] == 'G'):
			nuevo += fila[a + 1]
			nuevo += actual
			a += 1
		else:
			nuevo += actual
		a += 1
	return nuevo
a = input()
lista = a.split()
b = 0
actual = input()
while b < int(lista[1]):
	actual = f(actual)
	b += 1
print(actual)


(n, t) = (int(x) for x in input().split())
word = str(input())
q = []
for i in range(n):
	q.append(word[i])
for j in range(t):
	m = q[:]
	for i in range(n - 1):
		if m[i] == 'B' and m[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
p = ''
for i in range(n):
	p += q[i]
print(p)


a = list(map(int, input().split()))
b = input()
s = b.replace('BG', 'GB')
for i in range(a[1] - 1):
	s = s.replace('BG', 'GB')
print(s)


def p(lst):
	j = 1
	while j < len(lst):
		if lst[j - 1] == 'B' and lst[j] == 'G':
			(lst[j - 1], lst[j]) = ('G', 'B')
			j += 2
		else:
			j += 1
(n, t) = map(int, input().strip().split(' '))
s = input()
chain = list(s)
for i in range(t):
	p(chain)
print(''.join([str(k) for k in chain]))


(n, t) = [int(x) for x in input().split()]
ipt = list(input())
for i in range(t):
	f = False
	for j in range(n):
		if ipt[j] == 'B':
			f = True
		elif ipt[j] == 'G' and f:
			(ipt[j], ipt[j - 1]) = (ipt[j - 1], ipt[j])
			f = False
print(*ipt, sep='')


(n, t) = map(int, input().split())
q = input()
l = list(q)
for i in range(t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j = j + 1
		j = j + 1
listToStr = ''.join([str(elem) for elem in l])
print(listToStr)


(num, s) = map(int, input().split())
queue = input()
for i in range(s):
	new_queue = ''
	while len(queue) > 0:
		if queue[0] == 'G':
			new_queue += 'G'
			queue = queue[1:]
		elif len(queue) > 1 and queue[1] == 'G':
			new_queue += 'GB'
			queue = queue[2:]
		else:
			new_queue += 'B'
			queue = queue[1:]
	queue = new_queue
print(queue)


(n, t) = list(map(int, input().strip().split()))
w = input()
lstx = []
lsty = []
for i in w:
	lstx.append(i)
while t > 0:
	i = 0
	while i < len(lstx) - 1:
		if lstx[i] == 'B' and lstx[i + 1] == 'G':
			(lstx[i], lstx[i + 1]) = (lstx[i + 1], lstx[i])
			i = i + 1
		i = i + 1
	t = t - 1
for i in range(len(lstx)):
	print(lstx[i], end='')


string = str(input())
arr = string.split()
string2 = str(input())
q = []
for i in string2:
	q.append(i)
for i in range(int(arr[1])):
	pos = []
	for j in range(int(arr[0]) - 1):
		if q[j] == 'B' and q[j + 1] == 'G':
			pos.append(j)
	for k in pos:
		q[k] = 'G'
		q[k + 1] = 'B'
for i in q:
	print(i, end='')


def fun(s, n, m):
	if len(s) == 1:
		return s
	s = list(s)
	for i in range(m):
		j = 0
		while j < n - 1:
			if s[j] == 'B' and s[j + 1] == 'G':
				(s[j], s[j + 1]) = (s[j + 1], s[j])
				j += 1
			j += 1
	return ''.join(s)
(n, m) = list(map(int, input().split()))
s = input()
print(fun(s, n, m))


(n, t) = map(int, input().split())
A = list(input())
while t > 0:
	emp = None
	for i in range(len(A) - 1):
		if i == emp:
			continue
		if A[i] == 'B' and A[i + 1] == 'G':
			(A[i], A[i + 1]) = (A[i + 1], A[i])
			emp = i + 1
	t -= 1
print(''.join(A))


(n, t) = map(int, input().strip().split()[:2])
l = list(input().strip())
for y in range(t):
	x = 0
	while x < n:
		if x != n - 1:
			if l[x] == 'B' and l[x + 1] == 'G':
				(l[x], l[x + 1]) = ('G', 'B')
				x += 2
			else:
				x += 1
		else:
			x += 1
print(''.join(l))


(n, t) = map(int, input().split())
s1 = input()
s2 = s1
for i in range(0, t):
	for j in range(0, len(s1) - 1):
		if s1[j] == 'B' and s1[j + 1] == 'G':
			s2 = s2[:j] + 'GB' + s2[j + 2:]
	s1 = s2
print(s1)


(n, t) = map(int, input().split())
s = list(input())
a = s[:]
line = ''
for i in range(t):
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
	s = a[:]
for i in a:
	line += i
print(line)


(n, i) = map(int, input().split())
s = str(input())
for j in range(i):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
q = input()
for qwerty in range(t):
	t = ''
	i = 0
	while i < n:
		if q[i] == 'B' and i < n - 1 and (q[i + 1] == 'G'):
			t += 'GB'
			i += 1
		else:
			t += q[i]
		i += 1
	q = t
print(q)


(n, T) = map(int, input().split())
s = input()
s = [c == 'B' for c in s]
for _ in range(T):
	i = 0
	while i < len(s) - 1:
		if s[i] and (not s[i + 1]):
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
for i in s:
	if i:
		print('B', end='')
	else:
		print('G', end='')
print()


eingabe = input('')
que = input('')
l = []
zahl = ''
reihe = list(que)
ausgabe = ''
for i in range(len(eingabe)):
	if eingabe[i] != ' ':
		zahl = zahl + eingabe[i]
	else:
		l.append(int(zahl))
		zahl = ''
	if i == len(eingabe) - 1:
		l.append(int(zahl))
		zahl = ''
anzahl = l[0]
sekunden = l[1]
j = anzahl - 1
for i in range(sekunden):
	j = anzahl - 2
	while j >= 0:
		if reihe[j] == 'B' and reihe[j + 1] == 'G':
			reihe[j] = 'G'
			reihe[j + 1] = 'B'
			j = j - 2
		else:
			j = j - 1
for i in range(anzahl):
	ausgabe = ausgabe + reihe[i]
print(ausgabe)


(a, b) = map(int, input().split())
l = [i for i in input()]
for i in range(b):
	c = False
	for t in range(a - 1):
		if ord(l[t]) < ord(l[t + 1]):
			c = True
			continue
		if c:
			l[t] = 'B'
			l[t - 1] = 'G'
			c = False
	if c:
		l[t] = 'G'
		l[t + 1] = 'B'
print(''.join(l))


[n, t] = [int(i) for i in input().split()]
arr = [char for char in input()]
answer = arr[:]
for j in range(t):
	for i in range(n):
		if i > 0 and arr[i] == 'G' and (arr[i - 1] == 'B'):
			answer[i] = 'B'
			answer[i - 1] = 'G'
	arr = answer[:]
print(''.join(answer))


(n, k) = map(int, input().split())
string = input()
while k:
	string = string.replace('BG', 'GB')
	k -= 1
print(string)


str1 = input().split()
n = int(str1[0])
t = int(str1[1])
s = input()
for t1 in range(t):
	s1 = s
	for x in range(n - 1):
		if s1[x] == 'B' and s1[x + 1] == 'G':
			s2 = list(s)
			tmp = s2[x]
			s2[x] = s2[x + 1]
			s2[x + 1] = tmp
			s = ''.join(s2)
print(s)


x = list(map(int, input().split()))
y = input()
h = ''
i = 0
for i in range(x[1]):
	i = 0
	h = ''
	while i <= len(y) - 2:
		if y[i] == 'B' and y[i + 1] == 'G':
			h += y[i + 1]
			h += y[i]
			i += 2
		else:
			h += y[i]
			i += 1
	if len(y) > len(h):
		h += y[-1]
	y = h
print(h)


(n, k) = [int(x) for x in input().split()]
string = input()
lst = []
for x in string:
	lst.append(x)
for i in range(k):
	j = 0
	while j < n - 1:
		if lst[j] == 'B' and lst[j + 1] == 'G':
			(lst[j], lst[j + 1]) = ('G', 'B')
			j += 1
		j += 1
new_string = ''
for x in lst:
	new_string += x
print(new_string)


(n, m) = map(int, input().split())
o = list(input())
for t in range(m):
	i = 1
	while i < n:
		if o[i - 1] == 'B' and o[i] == 'G':
			(o[i - 1], o[i]) = (o[i], o[i - 1])
			i += 1
		i += 1
print(''.join(o))


num = list(map(int, input().strip().split()))
string = input().strip()
for i in range(num[1]):
	string = string.replace('BG', 'GB')
print(string)


(x, y) = map(int, input().split())
file = list(input())
for i in range(0, y):
	j = 0
	while j < x - 1:
		if file[j] == 'B' and file[j + 1] == 'G':
			(file[j], file[j + 1]) = (file[j + 1], file[j])
			j += 2
		else:
			j += 1
print(''.join(file))


(l, t) = map(int, input().split())
a = input()
for i in range(t):
	a = a.replace('BG', 'GB')
print(a)


import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())
(n, k) = invr()
a = instr()
for _ in range(k):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
for c in a:
	print(c, end='')


(n, s) = map(int, input().split())
children = input()
queue = []
queue[0:n] = children[0:n]
for i in range(s):
	j = 0
	while j < n:
		if j + 1 < n:
			if queue[j] == 'B' and queue[j + 1] == 'G':
				temp = queue[j]
				queue[j] = queue[j + 1]
				queue[j + 1] = temp
				j = j + 1
		j = j + 1
final_q = ''.join(queue)
print(final_q)


(n, t) = list(map(int, input().split(' ')))
Q = list(input())
for _ in range(t):
	sk = -1
	for (i, v) in enumerate(Q):
		if i != sk:
			p1 = Q[i + 1] if i < len(Q) - 1 else 0
			if v == 'B' and p1 == 'G':
				tmp = Q[i]
				Q[i] = Q[i + 1]
				Q[i + 1] = tmp
				sk = i + 1
print(''.join(Q))


(n, m) = map(int, input().split())
l = list(input())
s = []
count = 0
for j in range(m):
	p = []
	for i in range(n - 1):
		if i not in p:
			if l[i] == 'B':
				if l[i + 1] == 'G':
					l.pop(i)
					l.insert(i, 'G')
					l.pop(i + 1)
					l.insert(i + 1, 'B')
					p.append(i)
					p.append(i + 1)
print(''.join(l))


from sys import stdin, stdout
inp = stdin.readline
out = stdout.write
(n, t) = map(int, inp().strip().split())
l = list(inp().strip())
while t > 0:
	sw = []
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			sw.append([i, i + 1])
	for i in range(len(sw)):
		(l[sw[i][0]], l[sw[i][1]]) = (l[sw[i][1]], l[sw[i][0]])
	t -= 1
out(''.join(l))


a = input().split(' ')
n = int(a[0])
t = int(a[1])
s = list(input())
k = s.copy()
for _ in range(t):
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			k[i] = 'G'
			k[i + 1] = 'B'
	s = k.copy()
for i in range(len(s)):
	print(s[i], end='')


(n, t) = map(int, input().split())
q = list(input())
for _ in range(t):
	i = 1
	while i < n:
		if q[i] == 'G' and q[i - 1] == 'B':
			q[i] = 'B'
			q[i - 1] = 'G'
			i += 2
		else:
			i += 1
print(*q, sep='')


fl = input()
fls = fl.split(' ')
sl = input()
childsnum = int(fls[0])
turns = int(fls[1])
childs = []
for p in sl:
	childs.append(p)
currentTurn = 0
while currentTurn < turns:
	currentTurn += 1
	aux = []
	changed = False
	for i in range(0, len(childs) - 1):
		if changed:
			changed = False
			continue
		if childs[i] == 'B' and childs[i + 1] == 'G':
			childs[i] = 'G'
			childs[i + 1] = 'B'
			changed = True
end = ''
for c in childs:
	end += c
print(end)


(n, t) = list(map(int, input().split()))
s = input()
for i in range(t):
	a = []
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			a.append(i)
	for i in a:
		s = s[:i] + 'GB' + s[i + 2:]
print(s)


(n, k) = map(int, input().split())
s = input()
l = list(s)
for i in range(k):
	count = 0
	j = 0
	while j < n:
		if l[j] == 'B' and j + 1 < n:
			if l[j + 1] == 'G':
				t = l[j]
				l[j] = l[j + 1]
				l[j + 1] = t
				count += 1
				j += 2
			else:
				j += 1
		else:
			j += 1
	if count == 0:
		break
s1 = ''
for i in range(n):
	s1 += l[i]
print(s1)


(n, t) = [int(x) for x in input().split()]
st = input()[0:n]
for w in range(t):
	st = [i for i in st]
	if len(st) > 0:
		for i in range(len(st) - 1):
			if st[i] == 'B':
				if st[i + 1] == 'G':
					tmp = st[i]
					st[i] = st[i + 1]
					st[i + 1] = 'k'
	st = ''.join((x for x in st))
	st = str(st.replace('k', 'B'))
print(st)


i = int(input().split()[1])
s = input()
final = ''
current = ''
for _ in range(i):
	flag = False
	for pos in range(len(s)):
		if flag:
			flag = False
			continue
		value = s[pos]
		try:
			next_value = s[pos + 1]
		except IndexError:
			next_value = None
		if next_value:
			if value == 'B' and next_value == 'G':
				final += 'GB'
				flag = True
				continue
		final += s[pos]
	s = final
	final = ''
print(s)


def Main():
	(n, t) = map(int, input().split(' '))
	s = input()
	for i in range(t):
		s2 = s.replace('BG', 'GB')
		s = s2
	print(s)
Main()


data = input().split()
n = int(data[0])
t = int(data[1])
order = list(input())
for _ in range(t):
	i = 0
	while i < n - 1:
		if order[i] < order[i + 1]:
			order[i] = 'G'
			order[i + 1] = 'B'
			i += 2
		else:
			i += 1
order = ''.join(order)
print(order)


(a, b) = input().split()
c = input()
v = c
for i in range(int(b)):
	for j in range(int(a) - 1):
		if c[j] == 'B' and c[j + 1] == 'G':
			v = v[:j] + 'G' + v[j + 1:]
			v = v[:j + 1] + 'B' + v[j + 2:]
	c = v
print(c)


(a, b) = map(int, input().split())
s = input()
qwe = []
for i in s:
	qwe.append(i)
s = qwe
for i in range(b):
	i = 1
	while i < a:
		if s[i] == 'G' and s[i - 1] == 'B':
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			i += 1
		i += 1
ans = ''
for i in s:
	ans += i
print(ans)


s1 = input()
s1 = s1.split()
n = int(s1[0])
t = int(s1[1])
f = input()
s = []
j = 0
for i in f:
	s.append(i)
for k in range(t):
	j = 0
	for i in range(0, n - 1):
		if j == 1:
			j = 0
		elif s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			j = 1
for i in s:
	print(i, end='')


(n, t) = (int(i) for i in input().split())
l = [i for i in input()]
for i in range(0, t):
	c = 0
	while c < n - 1:
		if l[c] == 'B' and l[c + 1] == 'G':
			l[c] = 'G'
			c += 1
			l[c] = 'B'
		c += 1
print(''.join(l))


(n, t) = map(int, input().split())
queue = str(input())
for kk in range(0, t):
	final = ''
	i = 0
	while i < len(queue):
		if queue[i] == 'B' and (i + 1 < len(queue) and queue[i + 1] == 'G'):
			final += 'GB'
			i += 2
		else:
			final += queue[i]
			i += 1
	queue = final
print(queue)


(N, t) = map(int, input().split())
queue = input()
for _ in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


n = input()
n = n.split()
adet = int(n[1])
word = input()
for i in range(adet):
	if 'BG' in word:
		word = word.replace('BG', 'GB')
print(word)


(n, t) = list(map(int, input().split()))
s = input()
if 'B' not in s.rstrip('B'):
	print(s)
	exit()
s = list(s)
for _ in range(t):
	skip = False
	for i in range(n):
		if skip:
			skip = False
			continue
		elif i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				skip = True
print(''.join(s))


(s, t) = map(int, input().split())
d = input()
n = []
for i in range(s):
	n.append(d[i])
for _ in range(t):
	i = 0
	while i < s - 1:
		if n[i] == 'B' and n[i + 1] == 'G':
			(n[i], n[i + 1]) = (n[i + 1], n[i])
			i += 2
		else:
			i += 1
d = ''
for i in n:
	d += i
print(d)


(n, k) = map(int, input().split())
li = str(input())
l = list(li)
for y in range(k):
	i = 0
	while i < n:
		if i + 1 < n:
			if l[i] == 'B' and l[i + 1] == 'G':
				l[i] = 'G'
				l[i + 1] = 'B'
				i = i + 2
			else:
				i = i + 1
		else:
			break
print(''.join(l))


I = [int(i) for i in input().split()]
s = list(input())

def pos(s):
	k = []
	for j in range(I[0] - 1):
		if s[j] == 'B':
			k.append(j)
	return k
for i in range(I[1]):
	for i in pos(s):
		if s[i] == 'B':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
for i in s:
	print(i, end='')


(n, k) = map(int, input().split())
a = input()
t = list(a)
for j in range(k):
	i = 0
	while i < n - 1:
		if t[i] == 'B' and t[i + 1] == 'G':
			c = t[i]
			t[i] = t[i + 1]
			t[i + 1] = c
			if i < n - 2:
				i = i + 2
		elif i < n - 1:
			i = i + 1
x = ''.join(t)
print(x)


def get():
	res = [int(x) for x in input().split()]
	return res[0] if len(res) == 1 else res
(n, t) = get()
s = [c for c in input()]
for _ in range(t):
	i = 0
	while i + 1 < n:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = 'GB'
			i += 2
		else:
			i += 1
print(''.join(s))


(n, t) = map(int, input().split())
seq = input()
for i in range(t):
	if len(seq) == 1:
		break
	s = []
	for j in range(1, n):
		if seq[j] == 'G' and seq[j - 1] == 'B':
			s.append(j)
	for k in s:
		seq = seq[:k - 1] + 'GB' + seq[k + 1:]
print(seq)


(n, t) = map(int, input().split())
str1 = input()
ar = []
for i in range(len(str1)):
	ar.append(str1[i])
while t != 0:
	i = 1
	while i < len(str1):
		if ar[i] == 'G':
			if ar[i - 1] == 'B':
				(ar[i], ar[i - 1]) = (ar[i - 1], ar[i])
				i += 1
		i += 1
	t -= 1
str2 = ''.join(ar)
print(str2)


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def main():
	(n, ts) = M()
	tmp = input()
	q = []
	for i in range(n):
		q.append(tmp[i])
	while ts:
		i = 0
		while i < n:
			if q[i] == 'B' and i + 1 < n:
				if q[i + 1] == 'G':
					q[i] = 'G'
					q[i + 1] = 'B'
					i += 1
			i += 1
		ts -= 1
	for elm in q:
		print(elm, end='')
	print()
main()


(k, m) = map(int, input().split())
s = input()
for j in range(m):
	i = 0
	while i < k - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s = s[:i] + 'G' + 'B' + s[i + 2:]
			i += 2
		else:
			i += 1
print(s)


def shift(s):
	s = s.replace('BG', 'GB')
	return s
time = int(input().split(' ')[1])
initial = input()
for i in range(time):
	initial = shift(initial)
print(initial)


import sys
import math

def main():
	(n, t) = list(map(int, sys.stdin.readline().strip().split(' ')))
	qc = list(sys.stdin.readline().strip())
	qn = qc[:]
	for _ in range(t):
		for (i, j) in zip(range(n), range(1, n)):
			if qc[i] == 'B' and qc[j] == 'G':
				(qn[i], qn[j]) = (qc[j], qc[i])
		for i in range(n):
			qc[i] = qn[i]
	sys.stdout.write(''.join(qc))
main()


(n, m) = map(int, input().split())
arr = list(input())
for i in range(m):
	j = 0
	while j < n - 1:
		if arr[j] < arr[j + 1]:
			(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
			j += 1
		j += 1
print(''.join(arr))


(n, t) = map(int, input().split(' '))
a = list(map(str, input()))
for j in range(0, t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
res = ''
for i in range(0, n):
	res = res + a[i]
print(res)


def modify(q):
	j = 0
	while j < len(q):
		if j == len(q) - 1:
			break
		if q[j] is 'B' and q[j + 1] is 'G':
			q[j] = 'G'
			q[j + 1] = 'B'
			j = j + 2
		else:
			j += 1
	return q
(n, t) = [int(x) for x in input().split()]
q = input()
for _ in range(t):
	q = modify(list(q))
print(''.join(q))


(n, t) = map(int, input().split())
s = list(input())
k = 0
while t != 0:
	while k != n - 1:
		if s[k + 1] == 'G' and s[k] == 'B':
			(s[k + 1], s[k]) = (s[k], s[k + 1])
			k += 2
			if k == n:
				break
		else:
			k += 1
	t -= 1
	k = 0
print(*s, sep='')


import sys
from random import choice, randint
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, sys.stdin.readline().strip().split())

def LI():
	return list(map(int, sys.stdin.readline().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().strip().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().strip().split()]

def LS():
	return sys.stdin.readline().strip().split()

def I():
	return int(sys.stdin.readline().strip())

def F():
	return float(sys.stdin.readline().strip())

def S():
	return sys.stdin.readline().strip()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))
inp = sys.stdin.readline
out = sys.stdout.write

def main():
	(n, t) = MI()
	s = S()
	t1 = 0
	while t1 < t:
		i = 0
		ns = ''
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				ns += s[i + 1] + s[i]
				i += 2
			else:
				ns += s[i]
				i += 1
		if i != n:
			ns += s[i]
		s = ns
		t1 += 1
	pf(s)
main()


(data, seq, nseq) = (input().split(), input() + ' ', '')
for i in range(int(data[1])):
	char = 0
	while char < len(seq):
		if seq[char:char + 2] == 'BG':
			(char, nseq) = (char + 2, nseq + 'GB')
		else:
			(nseq, char) = (nseq + seq[char], char + 1)
	(seq, nseq) = (nseq + ' ', '')
print(seq)


sec = int(input()[2:])
word = input()
for i in range(sec):
	word = word.replace('BG', 'GB')
print(word)


list_of_first_line = list(map(int, input().split(' ')))
n = list_of_first_line[0]
t = list_of_first_line[1]
list_of_character = list(input())
if n == 1:
	print(list_of_character[0])
	exit(0)
for j in range(t):
	i = 0
	while True:
		if list_of_character[i] == 'B' and list_of_character[i + 1] == 'G':
			(list_of_character[i], list_of_character[i + 1]) = (list_of_character[i + 1], list_of_character[i])
			i = i + 1
		i = i + 1
		if i > n - 2:
			break
	j = j + 1
for i in list_of_character:
	print(i, end='')


a = int(input()[2:])
b = input()
while a:
	b = b.replace('BG', 'GB')
	a -= 1
print(b)


(n, k) = map(int, input().split())
a = list(input().strip())
for i in range(k):
	j = 0
	while j < n - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			j += 1
		j += 1
ans = ''
for an in a:
	ans += str(an)
print(ans)


s = list(map(int, input().split()))
r = input()
for _ in range(s[1]):
	r = r.replace('BG', 'GB')
print(r)


(n, t) = map(int, input().split())
s = input()
s1 = list(s)
for k in range(t):
	a_set = set()
	for c in range(0, n - 1):
		if s1[c] == 'B' and s1[c + 1] == 'G':
			a_set.add(c)
	for i in a_set:
		s1[i] = 'G'
		s1[i + 1] = 'B'
print(''.join((str(x) for x in s1)))


(amount, seconds) = tuple(map(int, input().split()))
queue = list(input())
for i in range(seconds):
	per_id = 0
	while per_id < len(queue) - 1:
		if queue[per_id] == 'B' and queue[per_id + 1] == 'G':
			queue[per_id] = 'G'
			queue[per_id + 1] = 'B'
			per_id += 1
		per_id += 1
print(''.join(queue))


answer = ''
c = 0
(length, time) = [int(i) for i in input().split()]
queue = list(input())
for i in range(time):
	c = 0
	while c < length - 1:
		if queue[c] == 'B':
			if queue[c + 1] == 'G':
				queue[c] = 'G'
				queue[c + 1] = 'B'
				c += 2
			else:
				c += 1
		else:
			c += 1
for i in range(length):
	answer = answer + str(queue[i])
print(answer)


values = input('').split()
(n, t) = [int(i) for i in values]
s = input('')
s = [str(i) for i in s]
for i in range(t):
	x = 0
	while x < n - 1:
		if s[x] == 'B' and s[x + 1] == 'G':
			s[x] = 'G'
			s[x + 1] = 'B'
			x += 2
		else:
			x += 1
ns = ''
for i in s:
	ns += i
print(ns)


def swap(i, j):
	tmp = line[i]
	line[i] = line[j]
	line[j] = tmp
a = input()
line = input()
a = a.split(' ')
num = a[0]
time = int(a[1])
line = [i for i in line]
while time > 0:
	time -= 1
	flagBoy = False
	for i in range(len(line)):
		if line[i] == 'B':
			flagBoy = True
		if flagBoy and line[i] == 'G':
			swap(i - 1, i)
			flagBoy = False
print(''.join(line))


def re(s, n):
	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 += 1
		i += 1
	return s

def main():
	(n, t) = [int(i) for i in input().split()]
	s = list(input())
	for i in range(t):
		s = re(s, n)
	print(''.join(map(str, s)))
main()


(a, b) = map(int, input().split())
s = list(input())
for i in range(b):
	for j in range(0, len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'V'
	while 'V' in s:
		d = s.index('V')
		s[d] = 'G'
		s[d + 1] = 'B'
print(''.join(s))


(n, k) = map(int, input().split())
a = list(input())
while k:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
	k -= 1
print(''.join(a))


(n, t) = map(int, input().split())
positions = input()
for time in range(t):
	positions = positions.replace('BG', 'GB')
print(positions)


(n, t) = input().split()
n = int(n)
t = int(t)
O = input()
o = list(O)
o.append(None)
while t >= 1:
	i = 0
	while i in range(0, n):
		if o[i] == 'B' and o[i + 1] == 'G' and (o[i + 1] != None):
			(o[i], o[i + 1]) = (o[i + 1], o[i])
			i += 2
		else:
			i += 1
	t -= 1
o.remove(None)
print(''.join(o))


(n, t) = input().split()
t = int(t)
Q = input()
while t:
	Q = Q.replace('BG', 'GB')
	t -= 1
print(Q)


data = list(map(int, input().split(' ')))
x = input()
for i in range(data[1]):
	pos = 0
	temp = ''
	s = list(x)
	while pos < data[0] - 1:
		if s[pos] == 'B' and s[pos + 1] == 'G':
			s[pos] = 'G'
			s[pos + 1] = 'B'
			pos += 2
		else:
			pos += 1
	x = ''.join(s)
print(x)


no = [int(item) for item in input().split()]
l = [item for item in input()]
lcopy = l.copy()
for j in range(no[1]):
	for (i, each) in enumerate(l):
		if each == 'G' and l[i - 1] == 'B' and (i > 0):
			(lcopy[i], lcopy[i - 1]) = (lcopy[i - 1], lcopy[i])
	l = lcopy.copy()
for each in lcopy:
	print(each, end='')


def totalRotate(totalStr, rotate):
	count = 0
	totalStr = list(totalStr)
	while count < rotate:
		count += 1
		l = 0
		while l < len(totalStr) - 1:
			if totalStr[l] == 'B' and totalStr[l + 1] == 'G':
				(totalStr[l], totalStr[l + 1]) = (totalStr[l + 1], totalStr[l])
				l += 1
			l += 1
	return ''.join(totalStr)
totalLen = input().split(' ')
totalStr = input()
print(totalRotate(totalStr, int(totalLen[1])))


def make(s, n):
	arr = []
	for i in range(n):
		arr.append(7)
	for i in range(1, n):
		try:
			if s[i] == 'G' and s[i - 1] == 'B':
				arr[i] = 1
				arr[i - 1] = 0
		except:
			pass
	ss = ''
	for i in range(n):
		if arr[i] == 0:
			ss = ss + 'G'
		elif arr[i] == 1:
			ss = ss + 'B'
		else:
			ss = ss + s[i]
	return ss
(n, t) = list(map(int, input().split()))
s = list(input())
d = make(s, n)
for i in range(t - 1):
	d = make(d, n)
print(d)


(n, t) = [int(i) for i in input().split()]
f = 0
s = list(input())
for j in range(t):
	f = 0
	for i in range(n - 1):
		if f:
			f = 0
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			f = 1
			(s[i], s[i + 1]) = (s[i + 1], s[i])
		else:
			f = 0
print(''.join(s))


(n, t) = map(int, input().split())
line = input()
lst = [i for i in line]
for i in range(t):
	j = 0
	while j < n - 1:
		if lst[j] == 'B' and lst[j + 1] == 'G':
			temp = lst[j]
			lst[j] = lst[j + 1]
			lst[j + 1] = temp
			j += 1
		j += 1
out = ''
for i in lst:
	out += i
print(out)


(x, i) = [int(w) for w in input().split()]
li = list(input())
for a in range(i):
	bol = False
	for b in range(x - 1):
		if bol:
			bol = False
			continue
		if li[b] == 'B':
			if li[b + 1] == 'G':
				(li[b], li[b + 1]) = (li[b + 1], li[b])
				bol = True
print(''.join(li))


(n, t) = map(int, input().split())
s = list(input())
counter = 0
while counter != t:
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
	counter += 1
ans = ''.join(s)
print(ans)


(n, t) = map(int, input().split())
queue = input()
for i in range(t):
	if 'BG' in queue:
		queue = queue.replace('BG', 'GB')
	else:
		queue = queue
print(queue)


def find(p):
	i = 0
	l = []
	while i < len(p) - 1:
		a = p[i]
		b = p[i + 1]
		if a < b:
			l.append(i)
		else:
			pass
		i = i + 1
	return l

def swap(z, p):
	i = 0
	while i < len(z):
		a = z[i]
		p = p[:a] + p[a + 1] + p[a] + p[a + 2:]
		i = i + 1
	return p
s = input().split()
n = int(s[0])
t = int(s[1])
p = input()
while t != 0:
	z = find(p)
	p = swap(z, p)
	t = t - 1
print(p)


(boys, sec) = map(lambda x: int(x), input().split(' '))
queue = list(input())
while sec:
	i = 1
	while i < len(queue):
		if queue[i] == 'G' and queue[i - 1] == 'B':
			(queue[i], queue[i - 1]) = (queue[i - 1], queue[i])
			i += 1
		i += 1
	sec -= 1
print(''.join(queue))


def school_queue(s, t):
	swaps = 0
	l = list(s)
	while swaps < t:
		i = 0
		while i + 1 < len(l):
			if l[i] == 'B' and l[i + 1] == 'G':
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				i += 2
			else:
				i += 1
		swaps += 1
	return ''.join(l)
x = list(map(int, input().rstrip().split()))
n = x[0]
t = x[1]
st = input()
print(school_queue(st, t))


(n, t) = map(int, input().split())
s = input()
let = []
for c in s:
	let.append(c)
let2 = let[:]
for _ in range(t):
	for i in range(len(let) - 1):
		if let[i] == 'B' and let[i + 1] == 'G':
			(let2[i], let2[i + 1]) = (let2[i + 1], let2[i])
	let = let2[:]
s = ''.join(let)
print(s)


(n, t) = map(int, input().split())
queue = input()
for _ in range(t):
	i = 0
	while i + 1 < len(queue):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue = queue[:i] + queue[i + 1] + queue[i] + queue[i + 2:]
			i += 1
		i += 1
print(queue)


(n, t) = map(int, input().split())
que = list(input())
j = 0
while t > 0:
	j = 0
	while j < n - 1:
		if que[j] == 'B' and que[j + 1] == 'G':
			(que[j], que[j + 1]) = (que[j + 1], que[j])
			changed = True
			j += 1
		j += 1
	t -= 1
print(*que, sep='')


(queue, time) = input().split()
(queue, time) = (int(queue), int(time))
s = list(input())
while time:
	while queue > 1:
		if s[queue - 1] == 'G' and s[queue - 2] == 'B':
			(s[queue - 1], s[queue - 2]) = (s[queue - 2], s[queue - 1])
			queue -= 2
		else:
			queue -= 1
	queue = len(s)
	time -= 1
print(''.join(s))


(n, t) = map(int, input().split())
initial_pos = list(input())
for _ in range(t):
	change_pos = []
	for i in range(n - 1):
		if initial_pos[i] == 'B' and initial_pos[i + 1] == 'G':
			change_pos.append(i)
	for pos in change_pos:
		(initial_pos[pos], initial_pos[pos + 1]) = (initial_pos[pos + 1], initial_pos[pos])
print(''.join(initial_pos))


str_0 = input()
list_0 = str_0.split(' ')
n = int(list_0[0])
t = int(list_0[1])
str_1 = input()
list_1 = list(str_1)

def move(list_1):
	n = len(list_1)
	if n == 1:
		return list_1
	else:
		list_2 = []
		for i in range(n):
			list_2.append(1)
		if list_1[0] == 'G':
			list_2[0] = 'G'
		elif list_1[1] == 'G':
			list_2[0] = 'G'
			list_2[1] = 'B'
		else:
			list_2[0] = 'B'
			list_2[1] = 'G'
		for i in range(1, n):
			if list_1[i] == 'G':
				if list_1[i - 1] == 'B':
					list_2[i] = 'B'
					list_2[i - 1] = 'G'
				else:
					list_2[i] = 'G'
			else:
				list_2[i] = 'B'
		return list_2
for i in range(t):
	list_1 = move(list_1)
print(''.join(list_1))


(n, t) = input().split()
s = input()
n = int(n)
t = int(t)
s = list(s)
indices = []
for i in range(t):
	indices = []
	for i in range(n):
		if s[i] == 'B':
			indices.append(i)
	for i in range(len(indices)):
		if indices[i] != n - 1 and s[indices[i] + 1] == 'G':
			(s[indices[i]], s[indices[i] + 1]) = ('G', 'B')
print(''.join(s))


(n, t) = map(int, input().split())
ppl = list(input())
for i in range(t):
	p = 0
	for z in range(len(ppl) - 1):
		if p:
			p = 0
			continue
		if ppl[z] == 'B' and ppl[z + 1] == 'G':
			(ppl[z], ppl[z + 1]) = (ppl[z + 1], ppl[z])
			p = 1
ppl = ''.join(ppl)
print(ppl)


s = list(map(int, input().split()))
lst1 = list(input(''))
k = s[1]
j = 0
while j < k:
	j = j + 1
	f = 0
	b = 1
	i = 0
	while i < len(lst1):
		i = i + 1
		if f >= len(lst1) or b >= len(lst1):
			break
		x = 0
		if lst1[f] == 'B' and lst1[b] == 'G':
			lst1[f] = 'G'
			lst1[b] = 'B'
			f = f + 2
			b = b + 2
		elif lst1[f] == 'B' and lst1[b] == 'B':
			f = b
			b = b + 1
		elif lst1[f] == 'G' and lst1[b] == 'G':
			f = b
			b = b + 1
		elif lst1[f] == 'G' and lst1[b] == 'B':
			f = b
			b = b + 1
i = 0
while i < len(lst1):
	print(lst1[i], end='')
	i = i + 1
print('')


(n, t) = list(map(int, input().split()))
a = list(input())
for k in range(t):
	b = a[:]
	for i in range(1, n):
		j = i - 1
		if a[j] < a[i]:
			(b[i], b[j]) = (b[j], b[i])
	a = b[:]
print(''.join(a))


(n, t) = list(map(int, input().split()))
a = list(input().upper())
for i in range(t):
	y = 1
	for j in range(1, len(a)):
		if j != y:
			continue
		if a[j - 1] == 'B' and a[j] == 'G':
			a[j - 1] = 'G'
			a[j] = 'B'
			y += 1
		y += 1
print(''.join(a))


(n, m) = map(int, input().split())
l = list(input())
for j in range(m):
	c = []
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			c.append(i)
	for k in c:
		t = l[k]
		l[k] = l[k + 1]
		l[k + 1] = t
print(*l, sep='')


(a, b) = map(int, input().split())
d = input()
D = {}
for i in range(a):
	D[i] = d[i]
for j in range(b):
	i = 1
	while i < a:
		if D[i] == 'G' and D[i - 1] == 'B':
			D[i] = 'B'
			D[i - 1] = 'G'
			i += 1
		else:
			pass
		i += 1
for i in range(a):
	print(D[i], end='')
print()


k = int(input()[2:])
j = input()
while k:
	j = j.replace('BG', 'GB')
	k = k - 1
print(j)


(n, t) = input().split()
t = int(t)
n = int(n)
strn = input()
for i in range(0, t):
	c = False
	for j in range(0, n):
		if c:
			c = False
			continue
		if strn[j] == 'B' and j < n - 1:
			if strn[j + 1] == 'G':
				strn = strn[:j] + strn[j + 1] + 'B' + strn[j + 2:]
				c = True
print(strn)


ln = list(map(int, input().strip().split(' ')))
l = ln[0]
n = ln[1]
arr1 = input()
arr = []
for i in range(l):
	arr.append(arr1[i])
for r in range(n):
	i = 0
	while i < l - 1:
		if arr[i] == 'B' and arr[i + 1] == 'G':
			temp = arr[i]
			b = arr[i + 1]
			arr[i] = b
			arr[i + 1] = temp
			i = i + 1
		i = i + 1
ans = ''
for i in arr:
	ans = ans + i
print(ans)


(n, t) = [int(x) for x in input().split()]
seq = list(input())
currentTime = 0
i = 0
while currentTime < t:
	while i < n - 1:
		if seq[i] == 'B' and seq[i + 1] == 'G':
			seq[i] = 'G'
			seq[i + 1] = 'B'
			i += 1
		i += 1
	currentTime += 1
	i = 0
print(''.join(seq))


(nc, t) = list(map(int, input().split()))
line = input()
for i in range(t):
	line = line.replace('BG', 'GB')
print(line)


(n, t) = map(int, input().split())
s = list(input())
d = ''
while t > 0:
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
	t -= 1
for i in range(len(s)):
	d += s[i]
print(d)


def boys_let_girls_advance(queue):
	counter = len(queue) - 1
	while counter > 0:
		if queue[counter] == 'G' and queue[counter - 1] == 'B':
			queue[counter] = 'B'
			queue[counter - 1] = 'G'
			counter -= 1
		counter -= 1
(number_of_children, time) = map(int, input().split(' '))
queue = list()
for child in input():
	queue.append(child)
while time != 0:
	boys_let_girls_advance(queue)
	time -= 1
print(''.join(queue))


(n, t) = [int(x) for x in input().split()]
l = list(input())
for i in range(t):
	l_ = []
	for j in range(n - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			l_.append(j)
		else:
			continue
	for k in l_:
		(l[k], l[k + 1]) = (l[k + 1], l[k])
print(''.join(l))


(n, t) = map(int, input().split())
queue = list(input())
index = []
for i in range(n):
	if queue[i] == 'B':
		index.append(i)
index.append(n + 1)
for i in range(t):
	for j in index:
		if j > n:
			break
		elif j + 1 >= n:
			break
		elif queue[j + 1] == 'G':
			queue[j] = 'G'
			queue[j + 1] = 'B'
	index = []
	for i in range(n):
		if queue[i] == 'B':
			index.append(i)
	index.append(n + 1)
for i in queue:
	print(i, end='')


integer = int
string = str
length = len

def main():
	(n, t) = list(map(integer, input().split()))
	s = list(input())
	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
				continue
			i += 1
	print(''.join(s))
main()


def sim(queue, time):
	queue_list = []
	for child in queue:
		queue_list.append(child)
	for _ in range(time):
		seguir = True
		for position in range(len(queue) - 1):
			if seguir == True:
				if queue_list[position] == 'B' and queue_list[position + 1] == 'G':
					queue_list[position + 1] = 'B'
					queue_list[position] = 'G'
					seguir = False
			else:
				seguir = True
	queue = ''
	for child in queue_list:
		queue += child
	return queue
(num, time) = input().split(' ')
queue = input()
print(sim(queue, int(time)))


import sys

def gets():
	return sys.stdin.readline().strip()

def get():
	return int(sys.stdin.readline().strip())

def geti():
	return map(int, sys.stdin.readline().strip().split())

def getli():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, t) = geti()
s = gets()
while t:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


lst = [int(x) for x in input().split()]
n = lst[0]
t = lst[1]
str = input()
for i in range(t):
	str = str.replace('BG', 'GB')
print(str)


(n, t) = map(int, input().split())
a = str(input())
for i in range(t):
	if 'BG' in a:
		a = a.replace('BG', 'GB')
print(a)


(n, k) = input().split(' ')
k = int(k)
lines = list(input())
while k:
	k -= 1
	i = 0
	while i < len(lines) - 1:
		if lines[i] == 'B' and lines[i + 1] == 'G':
			lines[i] = 'G'
			lines[i + 1] = 'B'
			i += 2
		else:
			i += 1
for i in lines:
	print(i, end='')


(n, t) = input().split()
string = str(input())
string = list(string)
for i in range(int(t)):
	j = 0
	while j <= int(n) - 2:
		if string[j] == 'B' and string[j + 1] == 'G':
			string[j] = 'G'
			string[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(string))


(n, t) = map(int, input().split())
l = input()
for j in range(t):
	l = l.replace('BG', 'GB')
print(l)


n = input()
n = n.split()
x = input()
i = 0
c = 0
while i < int(n[1]):
	x = x.replace('BG', 'GB')
	i = i + 1
print(x)


nt = list(map(int, input().split(' ')))
(n, t) = (nt[0], nt[1])
initial_arragement = str(input())
for i in range(t):
	j = 0
	while j < len(initial_arragement) - 1:
		if initial_arragement[j:j + 2] == 'BG':
			initial_arragement = initial_arragement[0:j] + 'GB' + initial_arragement[j + 2:]
			j += 2
			continue
		j += 1
print(initial_arragement)


(n, t) = map(int, input().split())
s = str(input())
l = list(s)
for j in range(t):
	i = 0
	while i < n - 1:
		if l[i] + l[i + 1] == 'BG':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(l))


(n, t) = [int(a) for a in input().split(' ')]
queue = [ch for ch in input()]
for _ in range(t):
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue[i] = 'G'
			queue[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(queue))


e = input().split(' ')
n = int(e[0])
t = int(e[-1])
s = list(input(''))
a = ''
for i in range(t):
	i = 0
	while i < n - 1:
		try:
			if s[i] == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				i += 1
		except:
			break
		i += 1
a = a.join(s)
print(a)


def cha(list):
	for i in range(len(list) - 1):
		if list[i] == 'B' and list[i + 1] == 'G':
			list[i] = 'G'
			list[i + 1] = 'B*'
	for i in range(len(list)):
		if list[i] == 'B*':
			list[i] = 'B'
	return list
(a, b) = map(int, input().split())
c = list(input())
for i in range(b):
	cha(c)
print(''.join(c))


(n, i) = map(int, input().strip().split())
s = input()
x = []
ns = ''
for t in s:
	x.append(t)
while i:
	j = 1
	while j < n:
		if x[j] == 'G' and x[j - 1] == 'B':
			(x[j], x[j - 1]) = (x[j - 1], x[j])
			j += 2
		else:
			j += 1
	i -= 1
for t in x:
	ns += t
print(ns)


(n, l) = map(int, input().split())
lst = list((x for x in input()))
for _ in range(l):
	i = 0
	while i < n - 1:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			(lst[i], lst[i + 1]) = (lst[i + 1], lst[i])
			i += 1
		i += 1
print(''.join(lst))


n_t = input().split()
n = int(n_t[0])
t = int(n_t[1])
s = list(input())
a = s[:]
for i in range(t):
	for j in range(len(s) - 1):
		if s[j] < s[j + 1]:
			(a[j], a[j + 1]) = (a[j + 1], a[j])
	s = a[:]
print(''.join(a))


(n, t) = map(int, input().split(' '))
line = list(input())
for _ in range(0, t):
	change = 0
	for i in range(0, n - 1):
		if line[i] == 'B' and line[i + 1] == 'G' and (change == 0):
			(line[i], line[i + 1]) = ('G', 'B')
			change = 1
		else:
			change = 0
print(''.join(line))


lines = []
while True:
	try:
		lines.append(input())
	except EOFError:
		break
seq = lines[1]
line_1 = lines[0].split(' ')
people = line_1[0]
time = line_1[1]
j = 1
while j <= int(time):
	i = 0
	sequ = []
	while i <= int(people) - 1:
		if i != int(people) - 1 and seq[i] == 'B' and (seq[i + 1] == 'G'):
			sequ.append('G')
			sequ.append('B')
			i = i + 2
		else:
			sequ.append(seq[i])
			i = i + 1
	s = ''
	seq = ''
	seq = s.join(sequ)
	j = j + 1
print(seq)


(n, m) = map(lambda x: int(x), input().split())
s = list(input())
for i in range(m):
	a = []
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			a.append(j)
	for x in a:
		(s[x], s[x + 1]) = ('G', 'B')
print(''.join(s))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
word = list(input())
time = 1
while time <= t:
	i = 0
	while i < n - 1:
		if word[i] == 'B' and word[i + 1] == 'G':
			(word[i], word[i + 1]) = (word[i + 1], word[i])
			i += 2
		else:
			i += 1
	time += 1
print(''.join(word))


a = [int(x) for x in input().split()]
n = a[0]
t = a[1]
s = ''
q = list(input())
for i in range(t):
	k = 0
	while k < n:
		f = 0
		if k != n - 1:
			if q[k] == 'B' and q[k + 1] == 'G':
				(q[k], q[k + 1]) = (q[k + 1], q[k])
				f = 1
			if f == 0:
				k += 1
			else:
				k += 2
		else:
			break
for x in q:
	s += x
print(s)


TymczasowaWewnetrzna = 0
PierwszaLinia = input().split(' ')
DrugaLinia = input()
ListaDzieci = list(DrugaLinia[0:len(DrugaLinia)])
Ile = int(PierwszaLinia[0])
CzasSekund = int(PierwszaLinia[1])
for i in range(CzasSekund):
	j = 0
	while j < Ile - 1:
		if ListaDzieci[j] == 'B' and ListaDzieci[j + 1] == 'G':
			Tymczasowa = ListaDzieci[j]
			ListaDzieci[j] = ListaDzieci[j + 1]
			ListaDzieci[j + 1] = Tymczasowa
			j += 1
		j += 1
ZmiennaPusta = ''
Wynik = ZmiennaPusta.join(ListaDzieci)
print(Wynik)


(n, t) = input().split()
s = input()
s = [c for c in s]
n = int(n)
t = int(t)
for i in range(t):
	temp = True
	for j in range(1, len(s)):
		if temp == True:
			if s[j] == 'G' and s[j - 1] == 'B':
				s[j] = 'B'
				s[j - 1] = 'G'
				temp = False
		else:
			temp = True
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	for k in range(n - 1):
		if s[k] == 'B' and s[k + 1] == 'G':
			(s[k], s[k + 1]) = ('G', 'b')
	s = [x.upper() for x in s]
S = ''.join([x.upper() for x in s])
print(S)


inp = input().split()
s = input()
str = []
for i in s:
	str.append(i)
for i in range(0, len(inp)):
	inp[i] = int(inp[i])
while inp[1] > 0:
	i = inp[0] - 1
	while i > 0:
		if str[i] == 'G':
			if i - 1 >= 0 and str[i - 1] == 'B':
				temp = str[i]
				str[i] = str[i - 1]
				str[i - 1] = temp
				i -= 1
		i -= 1
	inp[1] -= 1
print(''.join(str))


(n, t) = map(int, input().split())
nums = [i for (i, x) in enumerate(input()) if x == 'G']
for _ in range(t):
	nums = [max(0, x - 1) if i == 0 else x if nums[i - 1] == x - 1 else x - 1 for (i, x) in enumerate(nums)]
print(''.join(('BG'[bool(nums) and nums[0] == i and nums.pop(0) * 0 + 1] for i in range(n))))


(n, t) = map(int, input().split())
q = [i for i in input()]
for i in range(t):
	j = 0
	while j < len(q) - 1:
		if q[j] == 'B' and q[j + 1] == 'G':
			(q[j], q[j + 1]) = ('G', 'B')
			j += 1
		j += 1
print(''.join(q))


l = list(map(int, input().strip().split()))
n = l[0]
k = l[1]
s = input()
arr = list(s)
for j in range(k):
	i = 0
	while i < n:
		if arr[i] == 'G':
			i = i + 1
			continue
		elif i < n - 1:
			if arr[i] == 'B' and arr[i + 1] == 'G':
				(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
				i = i + 2
			else:
				i = i + 1
		else:
			i = i + 1
print(''.join((str(e) for e in arr)))


nt = list(map(int, input().split()))
n = nt[0]
t = nt[1]
s = list(input())
q = {}
temp = []
temp = s
pointer = 0
while t:
	while pointer <= len(s) - 2:
		if s[pointer] == 'B' and s[pointer + 1] == 'G':
			temp[pointer + 1] = 'B'
			temp[pointer] = 'G'
			pointer += 2
		else:
			pointer += 1
	t -= 1
	pointer = 0
	s = temp
final = ''
for ele in temp:
	final += ele
print(final)


(n, t) = str(input()).split(' ')
(n, t) = (int(n), int(t))
s = [a for a in str(input())]
for y in range(t):
	l = []
	for x in range(n - 1):
		if s[x:x + 2] == ['B', 'G']:
			l += [x]
	for x in l:
		(s[x], s[x + 1]) = ['G', 'B']
print(*(a for a in s), sep='')


(value1, value2) = map(int, input().split())
s = input()
a = []
for each in s:
	a.append(each)
i = 0
for each in range(value2):
	i = 0
	while i < len(s) - 1:
		if a[i] == len(s):
			break
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i = i + 1
		i = i + 1
i = 0
for each in a:
	print(a[i], end='')
	i = i + 1


def pos(l, t):
	if t > 0:
		i = 0
		while i < n - 1:
			if l[i] == 'B' and l[i + 1] == 'G':
				temp = l[i]
				l[i] = l[i + 1]
				l[i + 1] = temp
				i = i + 2
			else:
				i = i + 1
		t = t - 1
		if t == 0:
			print(''.join(l))
		pos(l, t)
(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
l = list(s)
pos(l, t)


def change(s):
	s2 = ''
	indices = []
	x = 0
	if len(s) == 1:
		return s
	while x < len(s) - 1:
		if s[x] == 'B' and s[x + 1] == 'G':
			s2 += 'GB'
			x += 2
		else:
			s2 += s[x]
			x += 1
		if x == len(s) - 1:
			s2 += s[x]
	return s2
(n, t) = [int(x) for x in input().split()]
s = input()
for x in range(0, t):
	s = change(s)
print(s)


(n, t) = map(int, input().split())
s = input()
li = list(s)
for i in range(t):
	li1 = []
	for j in range(1, n):
		if li[j] == 'G' and li[j - 1] == 'B':
			li1.append(j)
	for k in range(len(li1)):
		li[li1[k]] = 'B'
		li[li1[k] - 1] = 'G'
print(''.join(li))


(m, n) = map(int, input().split())
s = [x for x in input()]
for j in range(n):
	i = 0
	while i < m - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(s))


[n, rep] = [int(_) for _ in input().split()]
s = input()
for _ in range(rep):
	s = s.replace('BG', 'GB')
print(s)


import sys
(n, t) = [int(x) for x in sys.stdin.readline().split(' ')]
q = sys.stdin.readline().rstrip()
for _ in range(t):
	n_q = ''
	i = 0
	while i < n:
		if i == n - 1:
			n_q += q[i]
			i += 1
		elif q[i] == 'B' and q[i + 1] == 'G':
			n_q += 'GB'
			i += 2
		else:
			n_q += q[i]
			i += 1
	q = n_q
print(n_q)


a = list(map(int, input().split()))
(a, b) = (a[0], a[1])
ar = list(input())
while b:
	b -= 1
	i = 0
	while i < a - 1:
		if ar[i] == 'B' and ar[i + 1] == 'G':
			(ar[i], ar[i + 1]) = (ar[i + 1], ar[i])
			i = i + 1
		i += 1
print(''.join(ar))


num = input()
num = num.split(' ')
no = int(num[0])
sec = int(num[1])
line = input()
i = 0
j = 0
line = list(line)
while i < sec:
	j = 0
	while j < len(line) - 1:
		if line[j] == 'B' and line[j + 1] == 'G':
			line[j] = 'G'
			line[j + 1] = 'B'
			j = j + 1
		j = j + 1
	i = i + 1
line = ''.join(line)
print(str(line))


(n, t) = map(int, input().split())
s = list(input())

def fun(st):
	u = 1
	while u < n:
		if s[u - 1] == 'B' and s[u] == 'G':
			s[u - 1] = 'G'
			s[u] = 'B'
			f = 1
			u += 1
		u += 1
for i in range(t):
	fun(s)
print(*s, sep='')


def arrange(s, ql, time):
	for p in range(time):
		i = 1
		while i < ql:
			if s[i - 1] == 'B' and s[i] == 'G':
				(s[i - 1], s[i]) = ('G', 'B')
				i += 2
			else:
				i += 1
(n, t) = input().split()
r = input()
line = [x for x in r]
arrange(line, int(n), int(t))
print(''.join(line))


(n, t) = input().split()
queue = input()
for time in range(int(t)):
	newqueue = queue
	for i in range(int(n) - 1):
		if queue[i:i + 2] == 'BG':
			newqueue = newqueue[:i] + 'GB' + queue[i + 2:]
	queue = newqueue
print(queue)


(num, times) = map(int, input().split())
queue = input()
duplication = queue
for time in range(times):
	for i in range(1, len(queue)):
		if duplication[i] == 'G' and duplication[i - 1] == 'B':
			queue = queue[:i - 1] + 'GB' + queue[i + 1:]
	duplication = queue
print(queue)


i = input().split(' ')
val = int(i[1])
s = str(input())
con = 0
for con in range(val):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
positions = input()
while t > 0:
	s = ''
	i = 0
	while i <= n - 1:
		if i <= n - 2 and (positions[i], positions[i + 1]) == ('B', 'G'):
			(a, b) = (positions[i + 1], positions[i])
			s = s + a + b
			i += 2
		else:
			a = positions[i]
			s = s + a
			i += 1
	positions = s
	t -= 1
print(positions)


import math
inp = input().split()
n = eval(inp[0])
t = eval(inp[1])
s = list(input())

def swap(s):
	flag = False
	for i in range(n - 2, -1, -1):
		if flag:
			flag = False
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			flag = True
			s[i] = 'G'
			s[i + 1] = 'B'
	return s
for i in range(t):
	s = swap(s)
print(''.join(s))


def solve(x, time):
	y = list(x)
	while time > 0:
		i = 0
		while i < len(x) - 1:
			if y[i] == 'B' and y[i + 1] == 'G':
				(y[i], y[i + 1]) = (y[i + 1], y[i])
				i += 1
			i += 1
		time -= 1
	print(''.join(y))
y = list(map(int, input().split()))
x = input()
solve(x, y[1])


seconds = [int(i) for i in input().split()][1]
queue = [i for i in input()]
for i in range(seconds):
	pointer = 0
	while pointer < len(queue):
		try:
			if queue[pointer] == 'B' and queue[pointer + 1] == 'G':
				queue[pointer] = 'G'
				queue[pointer + 1] = 'B'
				pointer += 1
		except:
			pass
		pointer += 1
print(''.join(queue))


inp = list(map(int, input().split()))
s = list(input())
for _ in range(inp[1]):
	flag = True
	for i in range(1, inp[0]):
		if flag and s[i - 1] == 'B' and (s[i] == 'G'):
			s[i] = 'B'
			s[i - 1] = 'G'
			flag = False
			continue
		flag = True
print(''.join(s))


(n, t) = [int(x) for x in input().split()]
a = list(input())
for z in range(t):
	i = 1
	while i < len(a):
		if a[i - 1] == 'B' and a[i] == 'G':
			a[i - 1] = 'G'
			a[i] = 'B'
			i += 1
		i += 1
print(''.join(a))


(x, y) = [int(q) for q in input().split()]
a = input()
b = []
b = list(a)
for i in range(y):
	j = 0
	while j < x - 1:
		if b[j] == 'B' and b[j + 1] == 'G':
			b[j + 1] = 'B'
			b[j] = 'G'
			j += 1
		j += 1
for i in range(x):
	print(b[i], end='')


(n, k) = map(int, input().split())
lis = list(input())
while k != 0:
	i = 0
	while True:
		if i == n or i + 1 == n:
			break
		if lis[i] == 'B' and lis[i + 1] == 'G':
			(lis[i], lis[i + 1]) = (lis[i + 1], lis[i])
			i += 2
		else:
			i += 1
	k -= 1
print(''.join(lis))


(a, b) = map(int, input().split())
c = input()
i = 0
while b > 0:
	c = c.replace('BG', 'GB')
	b = b - 1
print(c)


li = [int(x) for x in input().split()]
(n, t) = (li[0], li[1])
qu = input()
for i in range(t):
	qu = qu.replace('BG', 'GB')
print(qu)


(a, b) = (int(x) for x in input().split())
s = [x for x in input()]
for i in range(b):
	l = list()
	for j in range(a - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			l.append(j)
	for j in l:
		s[j] = 'G'
		s[j + 1] = 'B'
print(''.join(s))


(raw_n, raw_t) = input().split()
n = int(raw_n)
t = int(raw_t)
s = input()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


from array import array
from sys import stdin
import bisect
from bisect import *
import itertools
from itertools import *

def scan_gen():
	for line in stdin:
		yield from iter(line.split())
scan = scan_gen()

def nint():
	return int(next(scan))

def nintk(k):
	return tuple((nint() for _ in range(k)))

def nfloat():
	return float(next(scan))

def intar_init(size):
	return array('i', [0]) * size

def intar(size=None):
	if size == None:
		size = nint()
	arr = intar_init(size)
	for x in range(size):
		arr[x] = nint()
	return arr

def move(a):
	r = ''
	i = 0
	while i < len(a):
		if a[i] == 'B' and i + 1 < len(a) and (a[i + 1] == 'G'):
			r += 'GB'
			i += 2
		else:
			r += a[i]
			i += 1
	return r

def solve():
	(n, t) = nintk(2)
	s = next(scan)
	for _ in range(t):
		s = move(s)
	print(s)
solve()


(n, m) = map(int, input().split())
word = input()
for i in range(0, m):
	word = word.replace('BG', 'GB')
print(word)


(k, n) = map(int, input().split())
t = []
for i in input():
	if i == 'B':
		t += ['B']
	elif i == 'G':
		t += ['G']
for i in range(n):
	s = t[0:]
	for j in range(k - 1):
		if t[j] == 'B' and t[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
	t = s
print(''.join(t))


(n, k) = map(int, input().split())
s = input()
s = list(s)
for i in range(k):
	p1 = 0
	p2 = 1
	while p2 <= n - 1:
		if s[p1] == 'B' and s[p2] == 'G':
			te = s[p1]
			s[p1] = s[p2]
			s[p2] = te
			p1 += 2
			p2 += 2
		else:
			p1 += 1
			p2 += 1
for i in s:
	print(i, end='')


(n, m) = map(int, input().split())
q = input()
s = []
for i in q:
	s.append(i)
for i in range(m):
	j = 0
	while j < len(s) - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			t = s[j]
			s[j] = s[j + 1]
			s[j + 1] = t
			j += 2
		else:
			j += 1
new = ''
for i in s:
	new = new + i
print(new)


t = int(input().split(' ')[1])
Line = input()
for j in range(t):
	Line = Line.replace('BG', 'GB')
print(Line)


def flip(q, i):
	q = q[:i] + 'GB' + q[i + 2:]
	return q
[n, t] = [int(x) for x in input().split()]
q = input()
for i in range(t):
	j = 0
	while j < n - 1:
		if q[j] == 'B' and q[j + 1] == 'G':
			q = flip(q, j)
			j += 1
		j += 1
print(q)


first = [int(x) for x in input().split(' ')]
string = input()
q = list(string)
time = 0
while time < first[1]:
	ctr = 0
	while ctr < first[0] - 1:
		if q[ctr] == 'B' and q[ctr + 1] == 'G':
			(q[ctr], q[ctr + 1]) = (q[ctr + 1], q[ctr])
			ctr += 1
		ctr += 1
	time += 1
print(''.join(q))


(n, t) = map(int, input().split())
s = list(str(input()))
curr = s.copy()
for _ in range(t):
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			(curr[i], curr[i + 1]) = ('G', 'B')
	s = curr.copy()
	curr = s.copy()
print(''.join(s))


(N, k) = [int(i) for i in input().split(' ')]
arr = list(input())
for j in range(k):
	i = 0
	while i < N - 1:
		if arr[i + 1] == 'G' and arr[i] == 'B':
			(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
			i += 2
		else:
			i += 1
print(''.join(arr))


n_t = input()
n = int(n_t.split()[0])
t = int(n_t.split()[1])
q = input()
l_q = list(q)
skip_next = False
while t > 0:
	for i in range(n - 1):
		if skip_next:
			skip_next = False
			continue
		if l_q[i] == 'B':
			if l_q[i + 1] == 'G':
				(l_q[i], l_q[i + 1]) = (l_q[i + 1], l_q[i])
				skip_next = True
	t -= 1
	skip_next = False
qu = ''
for i in l_q:
	qu += i
print(qu)


(m, n) = map(int, input().split())
a = list(input())
for _ in range(n):
	didijustswap = False
	for i in range(1, m):
		if a[i - 1] == 'B' and a[i] == 'G' and (not didijustswap):
			a[i - 1] = 'G'
			a[i] = 'B'
			didijustswap = True
		else:
			didijustswap = False
print(''.join(a))


(n, m) = map(int, input().split())
a = list(input())
for j in range(m):
	i = 0
	while i < len(a) - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			x = a[i + 1]
			a[i + 1] = a[i]
			a[i] = x
			i = i + 1
		i = i + 1
for i in range(len(a)):
	print(a[i], end='')


def get_input():
	input_str = input()
	(child_count, iter_count) = input_str.split()
	queue_order = input()
	if len(queue_order) != int(child_count):
		return None
	return (queue_order, int(iter_count))

def show_result(queue_order: list):
	queue_order = [chr(e) for e in queue_order]
	res = ''.join(queue_order)
	print(res)

def convert(queue_str: str) -> list:
	return [ord(c) for c in queue_str]

def sort(queue_order: list, iter_count: int) -> list:
	for _ in range(iter_count):
		i = 1
		while i < len(queue_order):
			if queue_order[i - 1] >= queue_order[i]:
				i += 1
				continue
			buf = queue_order[i - 1]
			queue_order[i - 1] = queue_order[i]
			queue_order[i] = buf
			i += 2
	return queue_order
input_data = get_input()
if input_data is None:
	exit(-1)
(queue_str, iter_count) = input_data
queue_order = convert(queue_str)
r = sort(queue_order, iter_count)
show_result(r)


import re
t = int(input().split(' ')[1])
s = input()
for i in range(t):
	s = re.sub('BG', 'GB', s)
print(s)


(length, times) = map(int, input().split())
queue = list(input())
index = 0
try:
	while queue[index] == 'G':
		index += 1
except:
	pass
for time in range(0, times, 1):
	temp_index = index
	while temp_index < length - 1:
		if queue[temp_index] == 'B' and queue[temp_index + 1] == 'G':
			queue[temp_index] = 'G'
			queue[temp_index + 1] = 'B'
			temp_index += 2
		else:
			temp_index += 1
print(''.join(queue))


(n, k) = list(map(int, input().split()))
res = []
ss = input()
s = [i for i in ss]
for _ in range(k):
	i = 1
	while i < n:
		if s[i] == 'G' and s[i - 1] == 'B':
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			i += 2
		else:
			i += 1
print(''.join(s))


(m, c) = [int(i) for i in input().split()]
bg = list(input())
d = 0
for i in range(c):
	for n in range(m):
		if n + d >= m - 1:
			break
		if bg[n + d] == 'B' and bg[n + d + 1] == 'G':
			(bg[n + d + 1], bg[n + d]) = (bg[n + d], bg[n + d + 1])
			d += 1
	d = 0
print(''.join(bg))


(m, t) = input().split()
n = int(m)
a = list(input())
for i in range(int(t)):
	l = 0
	while l <= n - 2:
		if a[l] < a[l + 1]:
			a[l] = 'G'
			a[l + 1] = 'B'
			l += 1
		l += 1
print(''.join(a))


a = int(input().split()[1])
b = input()
while a > 0:
	if 'BG' in b:
		b = b.replace('BG', 'GB')
	else:
		break
	a -= 1
print(b)


nt = input()
(n, t) = nt.split(' ')
l = input()
n = int(n)
t = int(t)
while t > 0:
	li = l.replace('BG', 'GB')
	l = li
	t -= 1
print(li)


def main():
	from sys import stdin, stdout
	(n, x) = map(int, stdin.readline().split())
	s = stdin.readline().strip()
	for _ in range(x):
		s = s.replace('BG', 'GB')
	stdout.write(s)
main()


(n, t) = [int(i) for i in input().split()]
queue = list(input())
for __ in range(t):
	i = 0
	while i <= n - 2:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = ('G', 'B')
			i += 2
			continue
		i += 1
print(''.join(queue))


a = input()
list_a = list(map(int, a.split()))
n = list_a[0]
t = list_a[1]
b = input()
list_b = list(b)

def useful_function(list_b, t):
	if t == 0:
		return list_b
	i = 0
	while i < len(list_b) - 1:
		if list_b[i] == 'G':
			i += 1
		elif list_b[i] == 'B':
			if list_b[i + 1] == 'G':
				list_b[i] = 'G'
				list_b[i + 1] = 'B'
				i += 2
			else:
				i += 1
	return useful_function(list_b, t - 1)
answer = ''
for letters in useful_function(list_b, t):
	answer += letters
print(answer)


nt = list(map(int, input().split()))
t = nt[1]
n = nt[0]
q = input()
jump = 0
for i in range(t):
	jump = 0
	for j in range(n - 1):
		if jump == 1:
			jump = 0
			continue
		if q[j] == 'B' and q[j + 1] == 'G':
			q = q[:j] + 'GB' + q[j + 2:]
			jump = 1
print(q)


student_and_time = input().split()
student_and_time = [int(f) for f in student_and_time]
students = list(input())
time = student_and_time[1]
while time > 0:
	i = 0
	while i < len(students) - 1:
		if students[i] == 'B' and students[i + 1] == 'G':
			(students[i], students[i + 1]) = ('G', 'B')
			i += 1
		i += 1
	time -= 1
print(''.join(students))


import sys
a = sys.stdin.readline().strip().split(' ')
(n, t) = (int(a[0]), int(a[1]))
b = sys.stdin.readline().strip()
line = list(b)
while t >= 1:
	i = 0
	while i <= n - 2:
		if line[i] == 'B' and line[i + 1] == 'G':
			(line[i], line[i + 1]) = (line[i + 1], line[i])
			i += 2
		else:
			i += 1
		if i > n - 1:
			break
	t -= 1
print(''.join(line))


nt = input().split(' ')
n = int(nt[0])
t = int(nt[1])
s = list(input())
for q in range(t):
	pp = False
	for i in range(len(s) - 1):
		if pp:
			pp = False
		elif s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			pp = True
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
s_lis = [s]
for i in range(t):
	b = 0
	s2 = ''
	while b < len(s) - 1:
		if s_lis[i][b] == 'B' and s_lis[i][b + 1] == 'G':
			s2 += 'GB'
			b += 2
		else:
			s2 += s_lis[i][b]
			b += 1
	if b == len(s) - 1:
		s2 += s_lis[i][b]
	s_lis.append(s2)
print(s_lis[-1])


(n, k) = (int(i) for i in input().split())
queue = list(input())
import copy
queue1 = copy.deepcopy(queue)
for t in range(k):
	for j in range(n - 1):
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue1[j], queue1[j + 1]) = (queue1[j + 1], queue1[j])
	queue = copy.deepcopy(queue1)
print(''.join(queue1))


(n, t) = input().split(' ')
string = input()
lista = []
for x in string:
	lista.append(x)
i = 0
k = 0
while k < int(t):
	while i < int(n):
		if i + 1 >= len(lista):
			i += 1
			break
		elif lista[i] == 'B' and lista[i + 1] == 'G':
			(lista[i], lista[i + 1]) = (lista[i + 1], lista[i])
			i += 1
		i += 1
	k += 1
	if i == int(n) and k < int(t):
		i = 0
for x in lista:
	print(x, end='')


N = input()
n = int(N.split()[0])
k = int(N.split()[1])
s = input()
slist = []
for item in s:
	slist.append(item)
for i in range(k):
	j = 0
	while j < len(slist) - 1:
		if slist[j] == 'B' and slist[j + 1] == 'G':
			(slist[j], slist[j + 1]) = (slist[j + 1], slist[j])
			j += 2
		else:
			j += 1
for items in slist:
	print(items, end='')


(l, t) = input().split()
b = input()
for _ in range(int(t)):
	s = b.replace('BG', 'GB')
	b = s
print(b)


input_list = []
num = 0
while True:
	if num == 2:
		break
	elif num == 1:
		line = list(input())
	else:
		line = input()
		line = line.split()
		line = list(map(int, line))
	input_list.append(line)
	num += 1
queue = input_list[1]
for sec in range(input_list[0][1]):
	count = 0
	while count < input_list[0][0]:
		if queue[count] == 'B' and count != input_list[0][0] - 1 and (queue[count + 1] == 'G'):
			queue[count] = 'G'
			queue[count + 1] = 'B'
			count += 1
		count += 1
print(''.join(queue))


(n, t) = map(int, input().split())
s = input()
a = [0 for i in range(100)]
time = 0
while time < t:
	time += 1
	b = [0 for i in range(100)]
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G' and (a[i] % 2 == 0) and (a[i + 1] % 2 == 0) and (b[i] == 0) and (b[i + 1] == 0):
			a[i] += 1
			a[i + 1] += 1
			b[i] = 1
			b[i + 1] = 1
		elif s[i] == 'G' and s[i + 1] == 'B' and (a[i] % 2 == 1) and (a[i + 1] % 2 == 1) and (b[i] == 0) and (b[i + 1] == 0):
			a[i] += 1
			a[i + 1] += 1
			b[i] = 1
			b[i + 1] = 1
		elif s[i] == 'B' and s[i + 1] == 'B' and (a[i] % 2 == 0) and (a[i + 1] % 2 == 1) and (b[i] == 0) and (b[i + 1] == 0):
			a[i] += 1
			a[i + 1] += 1
			b[i] = 1
			b[i + 1] = 1
		elif s[i] == 'G' and s[i + 1] == 'G' and (a[i] % 2 == 1) and (a[i + 1] % 2 == 0) and (b[i] == 0) and (b[i + 1] == 0):
			a[i] += 1
			a[i + 1] += 1
			b[i] = 1
			b[i + 1] = 1
for i in range(n):
	if a[i] % 2 == 0:
		print(s[i], end='')
	if a[i] % 2 == 1 and s[i] == 'B':
		print('G', end='')
	if a[i] % 2 == 1 and s[i] == 'G':
		print('B', end='')


x = list(map(int, input().split()))
n = x[0]
t = x[1]
pos = input()
arr = []
for i in range(len(pos)):
	arr.append(pos[i])
for i in range(t):
	j = 0
	while j < n - 1:
		if arr[j] == 'B' and arr[j + 1] == 'G':
			(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
			j += 2
		else:
			j += 1
ans = ''.join(arr)
print(ans)


a = list(map(int, input().split()))
s = list(input())
for j in range(a[1]):
	x = list(s)
	for i in range(a[0]):
		if i == 0:
			pass
		elif x[i] == 'G' and x[i - 1] == 'B':
			s[i - 1] = 'G'
			s[i] = 'B'
q = ''
for i in s:
	q = q + i
print(q)


(n, t) = [int(i) for i in input().split()]
line = list(input())
for i in range(t):
	e = 0
	is_changed = False
	while e != len(line) - 1:
		if line[e] == 'B' and line[e + 1] == 'G' and (not is_changed):
			(line[e], line[e + 1]) = (line[e + 1], line[e])
			is_changed = True
		else:
			is_changed = False
		e += 1
print(''.join(line))


(n, t) = list(map(int, input().split()))
s = input()
l = [x for x in s]
p = [x for x in s]
for i in range(t):
	for j in range(len(l) - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			p[j] = 'G'
			p[j + 1] = 'B'
	l = [x for x in p]
for i in p:
	print(i, end='')


(n, t) = [int(x) for x in input().split()]
queue = list(input())
cur_queue = queue[:]
result = ''
for i in range(t):
	for j in range(n - 1):
		if cur_queue[j] == 'B' and cur_queue[j + 1] == 'G':
			tmp = queue[j]
			queue[j] = queue[j + 1]
			queue[j + 1] = tmp
	cur_queue = queue[:]
result = result.join(queue)
print(result)


(n, t) = map(int, input().split())
q = input()
i = 0
while t:
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q = q[:i] + q[i + 1] + q[i] + q[i + 2:]
			i += 1
		i += 1
	t -= 1
	i = 0
print(q)


def queue(string, k):
	index = 0
	while index < k:
		i = 0
		while i <= len(string) - 2:
			if string[i] == 'B' and string[i + 1] == 'G':
				(string[i], string[i + 1]) = (string[i + 1], string[i])
				i = i + 1
			i = i + 1
		index = index + 1
	return ''.join(string)
(n, k) = map(int, input().split())
string = input()
print(queue(list(string), k))


(n, t) = map(int, input().split())
s = list(input())
s2 = s[:]
for _ in range(t):
	f = 0
	for i in range(1, n):
		if s[i] == 'G' and s[i - 1] == 'B':
			s2[i] = 'B'
			s2[i - 1] = 'G'
			f = 1
	if f == 0:
		break
	else:
		s = s2[:]
print(''.join(s))


(A, B) = input().split()
(a, b) = (int(A), int(B))
s = str(input())
i = 0
j = b
list = []
while i < len(s):
	list.append(s[i])
	i = i + 1
i = 0
if a % 2 == 0:
	while j != 0:
		while i < len(s) - 1:
			if list[i] == 'B' and list[i + 1] == 'G':
				(list[i], list[i + 1]) = (list[i + 1], list[i])
				i = i + 2
			else:
				i = i + 1
		i = 0
		j = j - 1
else:
	while j != 0:
		while i <= len(s) - 2:
			if list[i] == 'B' and list[i + 1] == 'G':
				(list[i], list[i + 1]) = (list[i + 1], list[i])
				i = i + 2
			else:
				i = i + 1
		i = 0
		if list[len(list) - 2] == 'B' and list[len(list) - 1] == 'G':
			(list[len(list) - 2], list[len(list) - 1]) = (list[len(list) - 1], list[len(list) - 2])
		j = j - 1
i = 0
while i < len(list):
	print(list[i], end='', sep='')
	i = i + 1


(n, tim) = [int(i) for i in input().split()]
s = input()
data = []
for i in range(n):
	if s[i] == 'B':
		data.append(1)
	else:
		data.append(0)
for t in range(tim):
	i = 0
	while i < n:
		if data[i] == 1 and i + 1 < n and (data[i + 1] == 0):
			data[i] = 0
			data[i + 1] = 1
			i += 2
		else:
			i += 1
ans = ''
for i in range(n):
	if data[i] == 1:
		ans = ans + 'B'
	else:
		ans = ans + 'G'
print(ans)


(n, t) = map(int, input().split())
pp = input().strip()
ll = []
for j in pp:
	ll.append(j)
for i in range(t):
	k = 0
	while k < n - 1:
		if ll[k] == 'B' and ll[k + 1] == 'G':
			ll[k] = 'G'
			ll[k + 1] = 'B'
			k += 1
		k += 1
print(''.join(ll))


(_, time, *_) = map(int, input().split(' '))
seq = input()
for _ in range(time):
	seq = seq.replace('BG', 'GB')
print(seq)


(n, t) = map(int, input().split(' '))
queue = list(input())
i = 0
while i < t:
	for j in range(1, n):
		if queue[j - 1] == 'B' and queue[j] == 'G':
			(queue[j - 1], queue[j]) = ('g', 'b')
	for j in range(n):
		queue[j] = queue[j].upper()
	i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
p = list(input())
a = 0
i = 0
while i < t:
	for x in range(len(p) - 1):
		if p[x] == 'B' and p[x + 1] == 'G' and (a == 0):
			(p[x], p[x + 1]) = (p[x + 1], p[x])
			a = 1
		elif a == 1:
			a = 0
			continue
	a = 0
	i += 1
print(''.join(p))


a = input().split()
n = int(a[0])
k = int(a[1])
s = list(input())
for i in range(k):
	t = []
	for j in range(n):
		if j + 1 < n and s[j] == 'B' and (s[j + 1] == 'G'):
			t += ['G']
		elif j - 1 >= 0 and s[j] == 'G' and (s[j - 1] == 'B'):
			t += ['B']
		else:
			t.append(s[j])
	s = t
t = ''
for i in s:
	t += i
print(t)


(n, t) = (int(i) for i in input().split(' '))
a = [i for i in input()]
new = a[:]
for _ in range(t):
	for i in range(1, n):
		if a[i - 1] == 'B' and a[i] == 'G':
			(new[i], new[i - 1]) = (a[i - 1], a[i])
	a = new[:]
print(''.join(a))


(n, t) = map(int, input().split())
a = bytearray(input(), encoding='utf-8')
for _ in range(t):
	i = 0
	while i < len(a) - 1:
		if a[i:i + 2] == b'BG':
			a[i:i + 2] = b'GB'
			i += 1
		i += 1
print(a.decode('utf-8'))


(people, repeat) = input().split()
queue = list(input())
for num1 in range(int(repeat)):
	num = 0
	while num < len(queue) - 1:
		if queue[num] == 'B' and queue[num + 1] == 'G':
			queue[num] = 'G'
			queue[num + 1] = 'B'
			num += 2
		else:
			num += 1
print(''.join(queue))


def mod():
	n = list(map(int, input().split()))
	x = input()
	i = 0
	j = 0
	g = ''
	c = []
	while i < n[1]:
		while j < n[0]:
			if j + 1 == n[0]:
				g = g + x[j]
				c.append(g)
				break
			elif x[j] == 'B' and x[j + 1] == 'G':
				g = g + ('G' + 'B')
				if j + 2 == len(x):
					break
				else:
					j = j + 2
			elif x[j] == 'G' and x[j + 1] == 'G':
				g = g + 'G'
				if j + 2 == len(x):
					g = g + 'G'
					break
				else:
					j = j + 1
			elif x[j] == 'B' and x[j + 1] == 'B':
				g = g + 'B'
				if j + 2 == len(x):
					g = g + 'B'
					break
				else:
					j = j + 1
			elif x[j] == 'G' and x[j + 1] == 'B':
				g = g + 'G'
				if j + 2 == len(x):
					g = g + 'B'
					break
				else:
					j = j + 1
		c.append(g)
		x = g
		g = ''
		j = 0
		i = i + 1
	print(c[-1])
mod()


(l, k) = map(int, input().split())
p = input()
st = list(p)
if len(st) == l:
	for i in range(0, k):
		j = 0
		while j < len(st) - 1:
			if st[j] == 'B' and st[j + 1] == 'G':
				temp = st[j]
				st[j] = st[j + 1]
				st[j + 1] = temp
				j += 2
			else:
				j += 1
print(''.join(st))


nt = list(map(int, input().split()))
(n, t) = (nt[0], nt[1])
queue = input()
for i in range(t):
	j = 0
	while j < n - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			queue = queue[:j] + 'GB' + queue[j + 2:]
			j += 2
		else:
			j += 1
print(queue)


(n, t) = map(int, input().split())
s = input()
for _ in range(t):
	sm = ''
	i = 0
	while i < n:
		if s[i] == 'B' and i != n - 1 and (s[i + 1] == 'G'):
			sm += 'GB'
			i += 1
		else:
			sm += s[i]
		i += 1
	s = sm
print(s)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
que = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if que[j] == 'B' and que[j + 1] == 'G':
			(que[j], que[j + 1]) = que[j + 1] + que[j]
			j += 2
		else:
			j += 1
for i in que:
	print(i, end='')


(n, t) = [int(x) for x in input().split()]
q = list(input())
for i in range(t):
	j = 0
	while j < n - 1:
		if q[j] == 'B' and q[j + 1] == 'G':
			(q[j], q[j + 1]) = (q[j + 1], q[j])
			j = j + 2
		else:
			j = j + 1
print(''.join((str(q[ij]) for ij in range(n))))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
(n, t) = L()
s = list(input())
for tme 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 += 1
		i += 1
print(''.join(s))
endtime = time.time()


(n, t) = map(int, input().split())
A = input()
B = list(A)
for _ in range(t):
	i = A.count('BG')
	p = -2
	for m in range(i):
		p = A.find('BG', p + 2)
		B[p] = 'G'
		B[p + 1] = 'B'
	A = ''.join(B)
print(A)


(n, t) = map(int, input().split())
ar = list(input())
curr = list(ar)
for i in range(t):
	for j in range(1, n):
		if ar[j] == 'G' and ar[j - 1] == 'B':
			(curr[j], curr[j - 1]) = (ar[j - 1], ar[j])
	ar = list(curr)
print(''.join(curr))


i = input
(k, a) = (int(i().split()[1]), i())
while k:
	a = a.replace('BG', 'GB')
	k -= 1
print(a)


l1 = [int(x) for x in input().split()]
n = l1[0]
t = l1[1]
inp = input()
l2 = []
for i in inp:
	l2.append(i)
while t > 0:
	i = 0
	while i < n - 1:
		if l2[i] == 'B' and l2[i + 1] == 'G':
			(l2[i], l2[i + 1]) = (l2[i + 1], l2[i])
			i += 2
		else:
			i += 1
	t -= 1
print(''.join(l2))


(n, t) = map(int, input().split())
line = input()

def find_all(s, c):
	idx = s.find(c)
	while idx != -1:
		yield idx
		idx = s.find(c, idx + 1)
boy_pos = list(find_all(line, 'B'))
limit = n
for _ in range(t):
	for i in range(len(boy_pos)):
		if boy_pos[i] + 1 < n and boy_pos[i] + 1 not in boy_pos:
			boy_pos[i] += 1
ans = ''
for i in range(n):
	if i not in boy_pos:
		ans += 'G'
	else:
		ans += 'B'
print(ans)


(n, n1) = map(int, input().split())
l1 = list(input())
while n1 != 0:
	n1 -= 1
	i = 0
	while i < n - 1:
		if l1[i] == 'B' and l1[i + 1] == 'G':
			l1[i] = 'G'
			l1[i + 1] = 'B'
			i += 2
		else:
			i += 1
for i in range(len(l1)):
	print(l1[i], end='')


temp = list(map(int, input().rstrip().split()))
n = temp[0]
t = temp[1]
s = input().rstrip()
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = [int(i) for i in input().split()]
sqn = list(input())
for i in range(t):
	prev = sqn[0]
	for j in range(1, len(sqn)):
		if prev == 'B' and sqn[j] == 'G':
			sqn[j - 1] = 'G'
			sqn[j] = 'B'
			prev = 'N'
		else:
			prev = sqn[j]
print(*sqn, sep='')


(n, t) = input().split()
n = int(n)
t = int(t)
str = input()
for i in range(t):
	k = 1
	while k < n:
		if str[k] == 'G' and str[k - 1] == 'B':
			str = str[:k - 1] + 'GB' + str[k + 1:]
			k += 2
		else:
			k = k + 1
print(str)


(x, y) = map(int, input().split())
a = list(input())
c = a.copy()
for i in range(y):
	for i in range(x - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			c[i] = 'G'
			c[i + 1] = 'B'
	a = c.copy()
print(*a, sep='')


(n, t) = [int(i) for i in input().split()]
a = list(input())
b = 0
while b < t:
	for i in range(n - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'A'
	for x in range(n):
		if a[x] == 'A':
			a[x] = 'B'
	b += 1
print(''.join(a))


(n, time) = map(int, input().split(' '))
x = input()
b = []
x_list = []
for i in x:
	x_list.append(i)
for k in range(time):
	j = 0
	while j < n - 1:
		if x_list[j] == 'B' and x_list[j + 1] == 'G':
			x_list[j] = 'G'
			x_list[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(x_list))


(n, k) = map(int, input().split())
s1 = input()
s = list(s1)
for i in range(k):
	i = 1
	while i < n:
		if s[i - 1] == 'B' and s[i] == 'G':
			(s[i - 1], s[i]) = (s[i], s[i - 1])
			i = i + 2
		else:
			i = i + 1
for i in s:
	print(i, end='')


(a, b) = map(int, input().split())
t = input()
for _ in range(b):
	t = t.replace('BG', 'GB')
print(t)


(n, t) = map(int, input().split())
l = list(input())
l = l[::-1]
h = ''
while t > 0:
	i = 0
	while i < len(l) - 1:
		j = i + 1
		if l[i] == 'G' and l[j] == 'B':
			P = l[i]
			l[i] = l[j]
			l[j] = P
			i += 1
		i += 1
	t -= 1
l = l[::-1]
for i in l:
	h += i
print(h)


(_, t) = [int(k) for k in input().split()]
l = list(input())
for i in range(t):
	n = False
	for j in range(len(l) - 1):
		if not n and l[j] == 'B' and (l[j + 1] == 'G'):
			(l[j], l[j + 1]) = ('G', 'B')
			n = True
		else:
			n = False
n = ''
for i in l:
	n += i
print(n)


import re
n = input().split()
text = input()
for i in range(int(n[1])):
	text = re.sub('BG', 'GB', text)
print(text)


(n, t) = input().split()
(n, t) = (int(n), int(t))
Ch = input()
while t != 0:
	Ch = Ch.replace('BG', 'GB')
	t -= 1
print(Ch)


(n, time) = list(map(int, input().split()))
line = input()
line = [char for char in line]
for t in range(time):
	swapped = False
	for i in range(n):
		if i == n - 1:
			break
		elif line[i] == 'B' and line[i + 1] == 'G' and (swapped == False):
			line[i] = 'G'
			line[i + 1] = 'B'
			swapped = True
		else:
			swapped = False
line = ''.join(line)
print(line)


def arrangements(arr, n, t):
	if n > 1:
		for i in range(t):
			flag = False
			for i in range(n - 1):
				if flag:
					flag = False
					continue
				if arr[i] == 'B' and arr[i + 1] == 'G':
					(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
					flag = True
	return ''.join(arr)
(n, t) = map(int, input().split())
arr = list(map(str, input().strip()))
print(arrangements(arr, len(arr), t))


(n, t) = map(int, input().split())
s = list(input())
for k in range(t):
	j = 0
	while j <= len(s) - 2:
		if s[j:j + 2] == ['B', 'G']:
			s[j:j + 2] = ['G', 'B']
			j = j + 2
		else:
			j = j + 1
print(''.join(s))


arr = list(map(int, input().split()))
n = arr[0]
t = arr[1]
line1 = input()
line = list(line1)
length = len(line1)
for i in range(0, t):
	j = 0
	c = []
	while j < length - 1:
		if line[j] == 'B' and line[j + 1] == 'G':
			c.append(j)
			j += 2
		else:
			j += 1
		if j > length - 1:
			break
	for k in c:
		(line[k], line[k + 1]) = (line[k + 1], line[k])
line = ''.join(line)
print(line)


(n, t) = map(int, input().split())
s = input()
l = list(s)
while t > 0:
	i = 0
	while True:
		if i >= len(l):
			break
		if l[i] == 'B':
			if i != len(l) - 1 and l[i + 1] == 'G':
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				i += 1
		i += 1
	t = t - 1
for i in range(0, len(l)):
	print(l[i], end='')
print()


(a, b) = map(int, input().split())
c = input()
d = [i for i in c]
for i in range(b):
	j = 0
	while j < a - 1:
		if d[j:j + 2] == ['B', 'G']:
			d[j:j + 2] = ['G', 'B']
			j = j + 2
		else:
			j = j + 1
print(''.join(d))


def f(s, t):
	for i in range(0, t):
		s = s.replace('BG', 'GB')
	return s
(n, t) = [int(_) for _ in input().split()]
s = input()
print(f(s, t))


quelle_parametrs = list(map(int, input().split()))
quelle = str(input())
count_iterations = quelle_parametrs[1]
while count_iterations > 0:
	quelle = quelle.replace('BG', 'GB')
	count_iterations -= 1
print(quelle)


nt = input()
nt = nt.split()
n = int(nt[0])
t = int(nt[1])
s = list(input())
for ix in range(0, t):
	six = s[:]
	for iy in range(0, len(s) - 1):
		if s[iy] == 'B' and s[iy + 1] == 'G':
			six[iy] = 'G'
			six[iy + 1] = 'B'
	s = six[:]
print(''.join(s))


def get_final_queue(q, t):
	l = len(q) - 1
	for i in range(t):
		j = 0
		while j < l:
			if q[j] == 'B' and q[j + 1] == 'G':
				(q[j], q[j + 1]) = (q[j + 1], q[j])
				j += 1
			j += 1
	return q
(n, t) = map(int, input().split())
q = list(input())
print(''.join(map(str, get_final_queue(q, t))))


(n, q) = map(int, input().split())
queue = list(input().strip())
for i in range(q):
	j = 0
	while j < n - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j], queue[j + 1]) = (queue[j + 1], queue[j])
			j += 1
		j += 1
print(''.join(queue))


(n, t) = map(int, input().split())
que = list(input())
ti = 1
while ti <= t:
	i = 0
	while i <= n - 2:
		if que[i] == 'B' and que[i + 1] == 'G':
			que[i] = 'G'
			que[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	ti = ti + 1
answer = ''.join(que)
print(answer)


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().split()))
arr = int_array()
n = arr[0]
times = arr[1]
s = list(input())
times2 = len(s)
for i in range(times):
	j = 0
	while j != times2:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(s).strip())


(x, y) = list(map(int, input().split()))
t = input()
r = []
s = ''
for i in t:
	if i == 'B':
		r.append(1)
	else:
		r.append(0)
while y > 0:
	i = 0
	while i < len(r) - 1:
		if r[i] == 1 and r[i + 1] == 0:
			r[i] = 0
			r[i + 1] = 1
			i = i + 2
			continue
		i = i + 1
	y = y - 1
for i in range(x):
	if r[i] == 1:
		s = s + 'B'
	else:
		s = s + 'G'
print(s)


(a, b) = map(int, input().split())
line = list(input())
while b > 0:
	for i in range(a - 1):
		if ord(line[i]) == 66 and ord(line[i + 1]) == 71:
			line[i] = chr(71)
			line[i + 1] = chr(67)
	b -= 1
	for j in range(a):
		if ord(line[j]) == 67:
			line[j] = 'B'
print(''.join(line))


i = input().split()
(n, t) = (int(i[0]), int(i[1]))
line = input()
line = [i for i in line]
while t > 0:
	counter = 0
	if n > 2:
		for i in range(n):
			if counter + 1 < n and line[counter] == 'B' and (line[counter + 1] != 'B'):
				(line[counter], line[counter + 1]) = (line[counter + 1], line[counter])
				counter += 1
			counter += 1
	elif n == 1:
		break
	elif t == 1:
		(line[counter], line[counter + 1]) = (line[counter + 1], line[counter])
	t -= 1
for i in line:
	print(i, end='')


n = list(map(int, input().strip().split(' ')))
s = input()
while n[1] > 0:
	s = s.replace('BG', 'GB')
	n[1] -= 1
print(s)


(A, B) = map(int, input().split())
s = input()
for i in range(B):
	s = s.replace('BG', 'GB')
print(s)


import sys

class Scanner:

	def __init__(self):
		self.current_tokens = []

	def remaining_tokens(self):
		return len(self.current_tokens)

	def nextline(self):
		assert self.remaining_tokens() == 0, 'Reading next line with remaining tokens'
		return input()

	def nexttokens(self):
		return self.nextline().split()

	def nexttoken(self):
		if len(self.current_tokens) == 0:
			self.current_tokens = self.nexttokens()
		assert self.remaining_tokens() > 0, 'Not enough tokens to parse.'
		return self.current_tokens.pop(0)

	def nextints(self, n=-1):
		if n == -1:
			return list(map(int, self.nexttokens()))
		else:
			return (self.nextint() for i in range(n))

	def nextint(self):
		return int(self.nexttoken())

def quit():
	sys.exit(0)
stdin = Scanner()
nextint = stdin.nextint
nextints = stdin.nextints
nextline = stdin.nextline
(n, t) = nextints(2)
s = nextline()
a = [0] * n
for i in range(len(s)):
	if s[i] == 'B':
		a[i] = 1
for i in range(t):
	b = list(a)
	for j in range(len(a) - 1):
		if a[j] == 1 and a[j + 1] == 0:
			b[j] = 0
			b[j + 1] = 1
	a = b
s = ''
for i in a:
	if i == 0:
		s += 'G'
	else:
		s += 'B'
print(s)


(n, t) = [int(x) for x in input().split()]
l = list(input())
i = 1
for j in range(t):
	while i < n:
		if l[i - 1] == 'B' and l[i] == 'G':
			temp = l[i]
			l[i] = l[i - 1]
			l[i - 1] = temp
			i = i + 1
		i = i + 1
	i = 1
ans = ''
for i in l:
	ans = ans + i
print(ans)


def order(l):
	incl = 0
	for i in range(len(l) - 1):
		if l[i] == 'B' and l[i + 1] == 'G' and (incl == 0):
			l[i] = 'G'
			l[i + 1] = 'B'
			incl += 1
		elif incl > 0:
			incl -= 1
	return l
(n, t) = map(int, input().split())
l = list(input())
for i in range(t):
	l = order(l)
print(''.join(l))


line1 = input()
str = input()
nt = line1.split()
n = int(nt[0])
t = int(nt[1])
for i in range(0, t):
	str = str.replace('BG', 'GB')
print(str)


from sys import stdin
input = stdin.readline
(n, m) = map(int, input().split())
line = list(map(str, input().strip()))
for _ in range(m):
	i = 0
	while i < n - 1:
		if line[i + 1] == 'G' and line[i] == 'B':
			(line[i + 1], line[i]) = (line[i], line[i + 1])
			i += 1
		i += 1
for l in line:
	print(l, end='')


def getValue():
	inputs = input()
	inputs = inputs.split(' ')
	nosOfStudents = int(inputs[0])
	time = int(inputs[1])
	queue = input()
	getTheOrder(nosOfStudents, time, queue)

def getTheOrder(students, time, order):
	order = list(order)
	j = 0
	new = ''
	for i in range(0, time):
		j = 0
		new = ''
		for k in range(0, students):
			if j <= students - 2:
				if order[j] == 'B' and order[j + 1] == 'G':
					order[j] = 'G'
					order[j + 1] = 'B'
					j = j + 2
				else:
					j += 1
	for x in order:
		new += x
	print(new)
getValue()


(n, t) = list(map(int, input().split()))
queue1 = input()
for i in range(0, t):
	index = []
	for j in range(0, n - 1):
		if queue1[j] == 'B' and queue1[j + 1] == 'G':
			index.append(j)
	line = list(queue1)
	for k in index:
		(line[k], line[k + 1]) = (line[k + 1], line[k])
	queue1 = ''.join(line)
print(queue1)


(n, t) = map(int, input().split())
s = input()
sl = []
for c in s:
	sl.append(c)
j = 0
for i in range(t):
	while j < n - 1:
		if sl[j] == 'B' and sl[j + 1] == 'G':
			sl[j] = 'G'
			sl[j + 1] = 'B'
			j += 1
		j += 1
	j = 0
for k in sl:
	print(k, end='')


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())
(n, t) = isp()
s = list(sti())
j = 0
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s[j] = 'G'
			s[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(s))


(length, time) = map(int, input().split())
queue = list(input())
for current_time in range(time):
	i = 0
	while i < length - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue[i:i + 2] = ['G', 'B']
			i += 1
		i += 1
print(''.join(queue))


(number_of_children_in_the_queue, time_after_which_the_queue_will_transform_into_the_arrangement) = map(int, input().split(' '))
queue_string = input()
queue_list = list(queue_string)
for time in range(0, time_after_which_the_queue_will_transform_into_the_arrangement):
	i = 0
	while i < number_of_children_in_the_queue - 1:
		if queue_list[i] == 'B' and queue_list[i + 1] == 'G':
			queue_list[i] = 'G'
			queue_list[i + 1] = 'B'
			i += 2
		else:
			i += 1
final_queue = ''.join(queue_list)
print(final_queue)


import re
(n, t) = input().split(' ')
n = int(n)
t = int(t)
que1 = re.findall('\\w', input())
if n > 1:
	for i in range(t):
		N = 1
		j = True
		while j:
			if que1[N] == 'G' and que1[N - 1] == 'B':
				que1[N] = 'B'
				que1[N - 1] = 'G'
				N = N + 2
			else:
				N = N + 1
			if N >= n:
				j = False
print(''.join(que1))


import re
(L, n) = map(int, input().split())
k = input()
for i in range(0, n):
	k = re.sub('BG', 'GB', k)
print(k)


(nochild, time) = map(int, input().split())
queue = list(input())

def shift(queue, time):
	if time == 0:
		return queue
	else:
		index = 0
		while index in range(len(queue) - 1):
			if queue[index] == 'B' and queue[index + 1] == 'G':
				queue[index + 1] = 'B'
				queue[index] = 'G'
				index += 2
			else:
				index += 1
		return shift(queue, time - 1)
print(''.join(shift(queue, time)))


(number, time) = input().split()
number = int(number)
time = int(time)
sequence = input()
listSequence = []
for letter in sequence:
	listSequence.append(letter)
for l in range(0, time):
	i = 0
	while i < number - 1:
		if listSequence[i] == 'B' and listSequence[i + 1] == 'G':
			listSequence[i] = 'G'
			listSequence[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(listSequence))


(n, t) = map(int, input().split())
s = input()
l1 = list(s)
s1 = ''
for j in range(t):
	s1 = ''
	for i in range(n - 1):
		if s[i] != s[i + 1] and s[i + 1] == 'G':
			l1[i] = 'G'
			l1[i + 1] = 'B'
	s = ''.join(l1)
print(s)


def main():
	(num_kids, time) = map(int, input().split())
	kids = input()
	for i in range(time):
		kids = kids.replace('BG', 'GB')
	print(kids)
main()


def shuffle(sequence):
	i = 0
	while i < len(sequence) - 1:
		if sequence[i] == 'B' and sequence[i + 1] == 'G':
			sequence = sequence[:i] + 'GB' + sequence[i + 2:]
			i = i + 2
		else:
			i += 1
	return sequence
(n, t) = map(int, input().split())
sequence = input()
for i in range(t):
	sequence = shuffle(sequence)
print(sequence)


(n, k) = map(int, input().split())
que = list(input())
j = 0
for i in range(k):
	j = 1
	while j < n:
		if que[j - 1] == 'B' and que[j] == 'G':
			(que[j - 1], que[j]) = (que[j], que[j - 1])
			j += 1
		j += 1
str1 = ''
for ele in que:
	str1 += ele
print(str1)


(a, b) = map(int, input().split())
str1 = input()
s1 = 'BG'
s2 = 'GB'
for i in range(0, b):
	str1 = str1.replace(s1, s2)
print(str1)


(numberOfStudents, time) = [int(x) for x in input().split(' ')]
studentQueue = input()
for i in range(0, time):
	studentQueue = studentQueue.replace('BG', 'GB')
print(''.join(studentQueue))


s1 = input()
(n, k) = s1.split()
n = int(n)
k = int(k)
s3 = input()
lst = []
for i in s3:
	lst.append(i)
for j in range(k):
	i = 0
	while i < n - 1:
		if lst[i] == 'B' and lst[i + 1] == 'G':
			(lst[i], lst[i + 1]) = ('G', 'B')
			i = i + 1
		i = i + 1
s3 = ''
for i in lst:
	s3 = s3 + i
print(s3)


xyz = input()
xyz = xyz.split()
(no1, no2) = (int(xyz[0]), int(xyz[1]))

def swap(a, b):
	temp = a
	a = b
	b = temp
abc = list(input())
for _ in range(0, no2):
	flag = 0
	list1 = []
	for i in range(0, no1 - 1):
		if abc[i] is 'B' and abc[i + 1] is 'G':
			flag = 1
			list1.append(i)
	for k in list1:
		temp = abc[k]
		abc[k] = abc[k + 1]
		abc[k + 1] = temp
	if flag is 0:
		break
for i in abc:
	print(i, end='')


(a, b) = map(int, input().split())
r = [str(g) for g in input()]
while b > 0:
	b -= 1
	i = 0
	while i < a - 1:
		if r[i] == 'B' and r[i + 1] == 'G':
			r[i] = 'G'
			r[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(r))


(m, n) = map(int, input().split())
f = str(input())
for i in range(n):
	f = f.replace('BG', 'GB')
print(f)


(n, t) = list(map(int, input().split()))
queue = input()
for i in range(t):
	new_queue = []
	while len(new_queue) < n:
		j = len(new_queue)
		if j == n - 1:
			new_queue.append(queue[j])
			continue
		if queue[j] == 'B' and queue[j + 1] == 'G':
			new_queue.append('G')
			new_queue.append('B')
		else:
			new_queue.append(queue[j])
	queue = ''.join(new_queue)
print(queue)


def check(s, a, b):
	if s[a] == 'B' and s[b] == 'G':
		return True
	else:
		return False
(n, t) = list(map(int, input().rstrip().split()))
s = list(input())
i = 0
while t and i != len(s) and (len(s) > 1):
	if check(s, i, i + 1):
		(s[i + 1], s[i]) = (s[i], s[i + 1])
		i += 2
	else:
		i += 1
	if i >= len(s) - 1:
		t -= 1
		i = 0
final = ''.join(s)
print(final)


(n, m) = list(map(int, input().split()))
st = input()
for i in range(m):
	st = st.replace('BG', 'GB')
print(st)


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	j = 0
	for _ in range(len(s)):
		if j >= len(s) - 1:
			break
		if s[j] < s[j + 1]:
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
print(''.join(s))


line = input().split(' ')
n = int(line[0])
t = int(line[1])
string = input()
string1 = []
for x in string:
	string1.append(x)

def switch(list1):
	newList = list1[:]
	for x in range(1, n):
		if list1[x - 1] == 'B' and list1[x] == 'G':
			newList[x] = 'B'
			newList[x - 1] = 'G'
	return newList
while t > 0:
	string1 = switch(string1)
	t = t - 1
print(''.join(string1))


from sys import stdin
x = stdin.read().rstrip().split()
n = int(x[0])
t = int(x[1])
sequence = x[2:][0]
for sec in range(t):
	i = 0
	while i < n - 1:
		if sequence[i] == 'B' and sequence[i + 1] == 'G':
			s = list(sequence)
			s[i] = s[i + 1]
			s[i + 1] = 'B'
			sequence = ''.join(s)
			i += 2
		else:
			i += 1
print(sequence)


i = input()
i = i.split()
seconds = i[1]
seconds = int(seconds)
z = input()
line = list(z)
swapped = False
for f in range(0, seconds):
	swapped = False
	for y in range(0, len(line) - 1):
		if swapped == True:
			swapped = False
		elif line[y] == 'B' and line[y + 1] == 'G':
			line[y + 1] = 'B'
			line[y] = 'G'
			swapped = True
print(''.join(line))


(n, t) = map(int, input().split())
b = input()
c = ''
for i in range(t):
	b = b.replace('BG', 'GB')
print(b)


(a1, t1) = input().split()
a = int(a1)
t = int(t1)
line = input()
n = 0
while n < t:
	line = line.replace('BG', 'GB')
	n += 1
print(line)


(n, m) = map(int, input().split(' '))
order = input()
for j in range(m):
	i = 0
	while i < n - 1:
		if order[i] == 'B':
			if order[i + 1] == 'G':
				order = order[0:i] + order[i].replace('B', 'G') + order[i + 1].replace('G', 'B') + order[i + 2:]
				i += 2
			else:
				i += 1
		else:
			i += 1
print(order)


(n, t) = list(map(int, input().split(' ')))
s = input()
l = list(s)
time = 0
for i in range(t):
	a = []
	for j in range(len(l) - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			a.append(j)
	for j in a:
		(l[j], l[j + 1]) = (l[j + 1], l[j])
	if len(a) == 0:
		time = i + 1
		break
print(''.join(l))


def main():
	(n, t) = map(int, input().split())
	queue = list(input())
	for time in range(0, t):
		new_que = queue.copy()
		for kid in range(0, n - 1):
			if queue[kid] == 'B' and queue[kid + 1] == 'G':
				new_que[kid] = 'G'
				new_que[kid + 1] = 'B'
		queue = new_que.copy()
	q_str = ''
	for qq in queue:
		q_str = q_str + qq
	print(q_str)
	return 1
main()


(n, t) = [int(x) for x in input().split(' ')]
queue = [x for x in input()]
for i in range(0, t):
	skip = False
	for j in range(1, len(queue)):
		if queue[j - 1] == 'B' and queue[j] == 'G' and (skip == False):
			(queue[j], queue[j - 1]) = (queue[j - 1], queue[j])
			skip = True
			continue
		skip = False
print(*queue, sep='')


(a, b) = map(int, input().split())
n = list(input())
B = 'B'
G = 'G'
for h in range(b):
	i = 0
	while i < a - 1:
		if n[i] == 'B' and n[i + 1] == 'G':
			n[i] = 'G'
			n[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(n))


def one_sec(queue):
	i = 1
	while i < len(queue):
		if queue[i] == 'G' and queue[i - 1] == 'B':
			queue[i] = 'B'
			queue[i - 1] = 'G'
			i += 1
		i += 1
	return queue
q = str()
(n, t) = map(int, input().split())
queue = list(map(str, input()))
for i in range(t):
	queue = one_sec(queue)
for j in queue:
	q += j
print(q)


(n, t) = map(int, input().split())
queue = input()
queue2 = queue
queue = list(queue)
new = ''
if n >= 2:
	for i in range(t):
		if i >= 1:
			queue = list(new)
			new = ''
		if queue[0] == 'B' and queue[1] == 'G':
			new = new + 'G'
		else:
			new = new + queue[0]
		for j in range(1, n - 1):
			if queue[j] == 'B' and queue[j + 1] == 'G':
				new = new + 'G'
			elif queue[j] == 'G' and queue[j - 1] == 'B':
				new = new + 'B'
			else:
				new = new + queue[j]
		if queue[n - 1] == 'G' and queue[n - 2] == 'B':
			new = new + 'B'
		else:
			new = new + queue[n - 1]
else:
	new = queue2
print(new)


arr = list(map(int, input().split()))
q = list(input())
for i in range(arr[1]):
	flag = 0
	x = 0
	for j in range(1, arr[0]):
		if q[j - 1] == 'B' and flag == 0 and (q[j] != 'B'):
			x = q[j - 1]
			q[j - 1] = q[j]
			q[j] = x
			flag = 1
		else:
			flag = 0
print(''.join(q))


(n, t) = map(int, input().split())
s = input()
res = []
for i in s:
	res.append(i)
while t > 0:
	j = 0
	while j < len(res) - 1:
		if res[j] < res[j + 1]:
			(res[j], res[j + 1]) = (res[j + 1], res[j])
			j += 2
		else:
			j += 1
	t -= 1
print(''.join(res))


(n, t) = map(int, input().split())
st = [x for x in input()]
for i in range(t):
	pos = 0
	while pos < n - 1:
		if st[pos] == 'B' and st[pos + 1] == 'G':
			(st[pos], st[pos + 1]) = (st[pos + 1], st[pos])
			pos += 2
		else:
			pos += 1
print(''.join(st))


(n, t) = map(int, input().split())
str1 = input()
queue = [x for x in str1]
str2 = ''
for x in range(t):
	y = 0
	while y < n - 1:
		if queue[y] == 'B' and queue[y + 1] == 'G':
			queue[y] = 'G'
			queue[y + 1] = 'B'
			if y < n - 1:
				y += 1
		y += 1
for x in range(n):
	str2 += queue[x]
print(str2)


(n, t) = list(map(int, input().split()))
arr = input()
a = []
for i in range(len(arr)):
	a.append(arr[i])
while t != 0:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i += 2
		else:
			i += 1
	t -= 1
name = ''
for val in a:
	name += val
print(name)


a = input().split()
b = input()
c = ''
d = b
for i in range(int(a[1]) + 1):
	c = d
	d = ''
	j = 0
	while j < int(a[0]):
		try:
			if c[j] + c[j + 1] == 'BG':
				d += 'GB'
				j += 1
			else:
				d += c[j]
		except IndexError:
			d += c[j]
		j += 1
print(c)


(number, time) = [int(x) for x in input().split()]
queue = input()
new = queue
for i in range(time):
	for n in range(number):
		if n + 2 <= number and queue[n:n + 2] == 'BG':
			new = new[0:n] + 'GB' + new[n + 2:]
		else:
			continue
	queue = new
print(new)


(n, t) = input().split()
n = int(n)
t = int(t)
a = list(input())
flag = 0
for i in range(t):
	flag = 0
	for j in range(n - 1):
		if flag == 1:
			flag = 0
			continue
		if a[j] == 'B' and a[j + 1] == 'G':
			(a[j], a[j + 1]) = (a[j + 1], a[j])
			flag = 1
for ans in a:
	print(ans, end='')


(a, b) = map(int, input().split())
s = input()
for i in range(b):
	if 'BG' in s:
		s1 = s.replace('BG', 'GB')
		s = s1
print(s)


a = input().split()
a[0] = int(a[0])
a[1] = int(a[1])
b = input()
c = []
for i in range(a[1]):
	c = []
	for j in range(a[0] - 1):
		if b[j:j + 2] == 'BG':
			c.append(j)
	for j in range(len(c)):
		b = b[:c[j]] + 'GB' + b[c[j] + 2:]
print(b)


def hq9():
	n = list(map(int, input().split()))
	line = input()
	for i in range(n[1]):
		line = line.replace('BG', 'GB')
	return line
print(hq9())


def isSorted(s):
	temp = sorted(s)
	return temp[::-1]
(n, m) = list(map(int, input().split()))
s = list(input())
for i in range(m):
	if isSorted(s) == s:
		break
	j = 0
	while j < len(s) - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = ('G', 'B')
			j += 2
		else:
			j += 1
print(''.join(s))


import re
(n, t) = [x for x in input().split()]
line = input()
for i in range(int(t)):
	m = re.finditer('BG', line)
	a = [i.start() for i in m]
	line = list(line)
	for i in a:
		(line[i], line[i + 1]) = (line[i + 1], line[i])
	line = ''.join(line)
print(line)


(n, t) = map(int, input().split())
c = list(input(''))
for i in range(t):
	c2 = c.copy()
	for e in range(len(c) - 1):
		if c[e] == 'B' and c[e + 1] == 'G':
			c2[e] = 'G'
			c2[e + 1] = 'B'
	c = c2.copy()
print(''.join(c))


(n, t) = [int(x) for x in input().split()]
s = input().rstrip()
s = [s[i] for i in range(len(s))]
for i in range(t):
	i = 0
	while i <= n - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
for i in range(n):
	print(s[i], end='')


def main():
	inp = input().split()
	(n, t) = (int(inp[0]), int(inp[1]))
	inp2 = input()
	L = []
	for i in inp2:
		L.append(i)
	for j in range(t):
		i = 0
		while i < n - 1:
			if L[i + 1] == 'G' and L[i] == 'B':
				(L[i + 1], L[i]) = (L[i], L[i + 1])
				i += 2
			else:
				i += 1
	print(''.join(L))
main()


(m, n) = map(int, input().split())
a = input()
a = list(a)
c = []
for i in range(n):
	for i in range(m - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			c.append(i)
	for i in c:
		(a[i], a[i + 1]) = (a[i + 1], a[i])
	c = []
res = ''
for i in a:
	res = res + i
print(res)


(n, t) = map(int, input().split())
pos = input()
for x in range(0, t):
	pos = pos.replace('BG', 'GB')
print(pos)


(n, t) = input().split(' ')
sequence = list(input())
swap = False
for i in range(int(t)):
	for j in range(int(n) - 1, 0, -1):
		if swap != True:
			if sequence[j] == 'G' and sequence[j - 1] == 'B':
				sequence[j] = 'B'
				sequence[j - 1] = 'G'
				swap = True
		else:
			swap = False
str = ''.join(sequence)
print(str)


(students, time) = map(int, input().split())
queue = input()

def simulate_queue(queue):
	return queue.replace('BG', 'GB')
for i in range(time):
	queue = simulate_queue(queue)
print(queue)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	nextContinue = False
	for j in range(n - 1):
		if not nextContinue and s[j] == 'B':
			if s[j + 1] == 'G':
				s = s[0:j] + 'GB' + s[j + 2:]
				nextContinue = True
		else:
			nextContinue = False
print(s)


def swap(q: list):
	w = 0
	while w < len(q) - 1:
		if q[w] == 'B' and q[w + 1] == 'G':
			q[w] = 'G'
			q[w + 1] = 'B'
			w += 2
			if w >= len(q) - 1:
				break
		else:
			w += 1
	return q
e = list(map(int, input().split()))
t = e[1]
s = list(input())
for j in range(t):
	swap(s)
for o in range(len(s)):
	print(s[o], end='')


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
q = list(s)
for i in range(t):
	flag = 1
	for j in range(len(q)):
		j = flag
		if j >= len(q):
			break
		elif q[j - 1] == 'B' and q[j] == 'G':
			(q[j - 1], q[j]) = (q[j], q[j - 1])
			flag = flag + 2
		else:
			flag = flag + 1
print(''.join(q))


(n, t) = map(int, input().split())
s = input()

def solve(x):
	if len(x) <= 1:
		return x
	if x[:2] == 'BG':
		return 'GB' + solve(x[2:])
	else:
		return x[0] + solve(x[1:])
for i in range(t):
	s = solve(s)
print(s)


c = ''
ins = input()
Li = ins.split()
n = int(Li[0])
t = int(Li[1])
s = input()
a = []
ans = []
for i in s:
	a.append(i)
	ans.append(i)
for i in range(t):
	for j in range(1, n):
		if ans[j] == 'G':
			if ans[j - 1] == 'B':
				a[j] = 'B'
				a[j - 1] = 'G'
	ans = a[:]
for l in ans:
	c += l
print(c)


(n, k) = [int(x) for x in input().split()]
s = input()
l = list(s)
m = 0
s1 = ''
index = []
while m < k:
	index = []
	for i in range(0, n):
		if l[i] == 'B':
			index.append(i)
	for j in index:
		if j != n - 1:
			if l[j] == 'B' and l[j + 1] == 'G':
				(l[j], l[j + 1]) = ('G', 'B')
	m += 1
for i in range(0, n):
	s1 = s1 + l[i]
print(s1)


(n, t) = map(int, input().split())
l = input()
st = list(range(len(l)))
for i in range(len(l)):
	st[i] = l[i]
k = ' '
j = 0
for i in range(t):
	j = 0
	while j < len(st) - 1:
		if st[j] == 'B' and st[j + 1] == 'G':
			(st[j], st[j + 1]) = (st[j + 1], st[j])
			j += 2
		else:
			j += 1
for i in st:
	print(i, end='')


(n, t) = list(map(int, input().split(' ')))
ss = input()
for z in range(t):
	ss = ss.replace('BG', 'GB')
print(ss)


inp = input()
n = int(inp[:inp.find(' ')])
t = int(inp[inp.find(' '):])
s = input()
for i in range(t):
	s2 = s
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			s2 = s2[:i] + 'GB' + s2[i + 2:]
	s = s2
print(s)


(x, y) = map(int, input().split())
a = list(input())
for j in range(y):
	c = []
	k = 0
	for i in range(len(a)):
		if i < len(a) - 1:
			if a[i] != a[i + 1]:
				if a[i] == 'B' and a[i + 1] == 'G':
					c.append(i)
					i = i + 2
				else:
					i += 1
				if i > len(a) - 1:
					break
			else:
				i += 1
	for i in c:
		(a[i], a[i + 1]) = (a[i + 1], a[i])
for i in a:
	print(i, end='')


(n, t) = input().split()
n = int(n)
t = int(t)
x = input()
x = list(x)
str = ''

def switch(x, i):
	temp = x[i]
	x[i] = x[i + 1]
	x[i + 1] = temp
for i in range(t):
	i = 0
	while i < len(x) - 1:
		if x[i] == 'B' and x[i + 1] == 'G':
			switch(x, i)
			i += 1
		i += 1
print(str.join(x))


(n, t) = [int(x) for x in input().split()]
v2 = str(input())
for i in range(t):
	j = 0
	b = ''
	while j < len(v2):
		if j == len(v2) - 1:
			b = b + v2[j]
			j = j + 1
		elif v2[j] == 'B' and v2[j + 1] == 'G':
			b = b + v2[j + 1]
			b = b + v2[j]
			j = j + 2
		else:
			b = b + v2[j]
			j = j + 1
	v2 = b
print(v2)


(n, t) = map(int, input().split())
a = list(input())
j = 0
while j < t:
	i = 0
	while i <= n - 2:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i += 2
		else:
			i += 1
	j += 1
A = ''
for i in a:
	A += i
print(A)


def rearrange(sequence, n):
	temp = sequence.copy()
	for i in range(n - 1):
		if sequence[i] is 'B' and sequence[i + 1] is 'G':
			(temp[i], temp[i + 1]) = (sequence[i + 1], sequence[i])
	return temp
(n, t) = map(int, input().split())
sequence = list(input().strip())
for i in range(t):
	temp = sequence.copy()
	sequence = rearrange(temp, n)
print(''.join(sequence))


from sys import stdin

def solve(y, queue):
	vec = ''
	for t in range(y):
		k = len(queue) - 1
		while k > 0:
			if queue[k] == 'G' and queue[k - 1] == 'B':
				queue[k - 1] = 'G'
				queue[k] = 'B'
				k -= 1
			k -= 1
	for i in range(len(queue)):
		vec = vec + str(queue[i])
	return vec

def main():
	(x, y) = stdin.readline().strip().split()
	queue = stdin.readline().strip()
	print(solve(int(y), list(queue)))
main()


(n, time) = input().split()
queue = list(input())
n = int(n)
time = int(time)
s = ''
for _ in range(0, time):
	i = 0
	while i < n - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
for item in queue:
	s += item
print(s)


d = input().split(' ')
n = int(d[0])
t = int(d[1])
s = [i for i in input()]
tmp = list(s)
while t > 0:
	has_modified = False
	for i in range(n - 1):
		if tmp[i] == 'B' and tmp[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			if not has_modified:
				has_modified = True
	tmp = list(s)
	if not has_modified:
		break
	t -= 1
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
a = s
for i in range(t):
	for j in range(n - 1):
		char1 = s[j]
		char2 = s[j + 1]
		if char1 == 'B' and char2 == 'G':
			a = a[:j] + 'GB' + a[j + 2:]
	s = a
print(a)


(students, seconds) = [int(i) for i in input().split()]
line = list(input())
for _ in range(seconds):
	copy = list(line)
	for i in range(1, len(line)):
		if line[i - 1] == 'B' and line[i] == 'G':
			copy[i - 1] = 'G'
			copy[i] = 'B'
	line = copy
print(''.join(line))


def Sol(que, n, time):
	ans = que
	for i in range(time):
		ind = []
		que = ans
		for b in range(n - 1):
			if ans[b] == 'B' and ans[b + 1] == 'G':
				ind.append(b)
		if len(ind) > 0:
			ans = ''
			for c in range(len(ind)):
				if c == 0:
					ans += que[:ind[c]] + 'GB'
				else:
					ans += que[ind[c - 1] + 2:ind[c]] + 'GB'
			if ind[-1] + 2 < n:
				ans += que[ind[-1] + 2:]
	print(ans)
	return
(n, time) = map(int, input().split(' '))
que = input()
Sol(que, n, time)


(queue_length, seconds_count) = [int(x) for x in input().split()]
queue = [1 if x == 'B' else 0 for x in input()]
for second in range(0, seconds_count):
	i = queue_length - 1
	while i >= 0:
		if queue[i] == 0:
			if i >= 1 and queue[i - 1] == 1:
				queue[i] = 1
				queue[i - 1] = 0
				i -= 1
		i -= 1
string_queue = ['B' if x == 1 else 'G' for x in queue]
print(''.join(string_queue))


(n, t) = map(int, input().split())
p = list(map(str, input()))
j = []
for i in range(n):
	j.append([])
for i in range(n):
	for k in range(t):
		j[i].append(1)
for g in range(t):
	for i in range(n - 1):
		if p[i] == 'B' and p[i + 1] == 'G' and (j[i][g] != 0) and (j[i + 1][g] != 0):
			t = p[i]
			p[i] = p[i + 1]
			p[i + 1] = t
			j[i][g] -= 1
			j[i + 1][g] -= 1
for i in range(n):
	if i != n - 1:
		print(p[i], end='')
	else:
		print(p[i])


input_1 = input()
input_2 = input()
t = int(input_1.split(' ')[1])
tiempo = 0
while tiempo < t:
	input_2 = input_2.replace('BG', 'GB')
	tiempo += 1
print(input_2)


(n, et) = list(map(int, input().split()))
st = input()
s = list(st)
t = 0
i = 1
while et > 0:
	i = 1
	while i < n:
		if s[i - 1] == 'B' and s[i] == 'G':
			temp = s[i - 1]
			s[i - 1] = s[i]
			s[i] = temp
			i = i + 2
		else:
			i = i + 1
	et = et - 1
for i in range(0, len(s)):
	print(s[i], end='')


li1 = input().split(' ')
li2 = list(input())
b = [i for (i, x) in enumerate(li2) if x == 'B']
temp = None
for i in range(int(li1[1])):
	for j in b:
		if j < len(li2) - 1 and li2[j + 1] == 'G':
			temp = li2[j]
			li2[j] = li2[j + 1]
			li2[j + 1] = temp
			num = b.index(j)
			b[num] = j + 1
		else:
			pass
print(''.join(li2))


import re

def mv(s):
	return re.sub('bg', 'gb', s)

def pc(n, s):
	s = s.lower()
	for _ in range(n):
		s = mv(s)
	return s.upper()
(_, n) = [int(x) for x in input().split()]
print(pc(n, input()))


(n, t) = map(int, input().split())
L = list(input())
for k in range(t):
	i = 0
	while i < len(L) - 1:
		if L[i] == 'B' and L[i + 1] == 'G':
			L[i] = 'G'
			L[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(L))


(std, times) = map(int, input().split(' '))
queue = input()

def swapedQueue(queue):
	swapedQueue = list(queue)
	for i in range(std - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			swapedQueue[i] = 'G'
			swapedQueue[i + 1] = 'B'
	return swapedQueue
t = 1
arrangedStds = swapedQueue(queue)
while t < times:
	arrangedStds = swapedQueue(arrangedStds)
	t += 1
print(''.join(arrangedStds))


(n, t) = map(int, input().split())
s = input()
s1 = []
for a in range(n):
	s1.append(s[a])
for i in range(t):
	j = 0
	while j < n - 1:
		x = s1[j]
		y = s1[j + 1]
		if x == 'B' and y == 'G':
			s1[j] = 'G'
			s1[j + 1] = 'B'
			j += 2
		else:
			j += 1
out = ''
for b in range(len(s1)):
	out += s1[b]
print(out)


(n, t) = map(eval, input().split())
s1 = input()
for i in range(t):
	s1 = s1.replace('BG', 'GB')
print(s1)


(n, t) = map(int, input().split())
s = input()
jr = 0
for i in range(t):
	for j in range(n):
		if jr:
			jr = 0
			continue
		if j >= n - 1:
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			s = s = s[:j] + 'GB' + s[j + 2:]
			jr = 1
print(s)


(n, t) = map(int, input().split(' '))
s = list(input())
if len(s) > 1:
	for _ in range(t):
		for (i, x) in enumerate(s[:-1]):
			if x == 'B' and s[i + 1] == 'G':
				p = s.pop(i)
				s.insert(i + 1, p)
	print(''.join(s))
else:
	print(''.join(s))


from copy import deepcopy
p = input()
p = p.split()
q = input()
qq = []
for i in range(0, int(p[0])):
	qq.append(q[i])
c = 1
qqd = deepcopy(qq)
while c <= int(p[1]):
	if c >= 2:
		qq = qqd
		qqd = deepcopy(qq)
	for i in range(0, int(p[0]) - 1):
		if qq[i] == 'B' and qq[i + 1] == 'G':
			qqd[i + 1] = 'B'
			qqd[i] = 'G'
	c = c + 1
t = ''
for i in range(len(qqd)):
	t = t + qqd[i]
print(t)


(n, t) = map(int, input().split())
s = list(input())
a = []
temp = ''
i = 0
while i < t:
	j = n - 1
	while j > 0:
		if s[j] == 'G' and s[j - 1] == 'B':
			a.append(j)
		j -= 1
	for b in a:
		s[b] = 'B'
		s[b - 1] = 'G'
	i += 1
for c in s:
	print(c, end='')


A = list(map(int, input().split()))
queue = str(input())
number = A[0]
time = A[1]
i = 0
new = []
newqueue = ''
for j in range(time):
	i = 0
	while i < number:
		if i == number - 1:
			new.append(queue[i])
			i += 1
		elif queue[i] == 'B' and queue[i + 1] == 'G':
			new.append('GB')
			i += 2
		else:
			new.append(queue[i])
			i += 1
	queue = ''
	for i in range(len(new)):
		queue += new[i]
	new = []
print(queue)


(a, b) = map(int, input().split())
s = [x for x in input()]
for j in range(b):
	i = 0
	while i < a - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
d = ''
for i in s:
	d += i
print(d)


numbers = input()
number = numbers.split()
children = int(number[0])
seconds = int(number[1])
order = input()
each = list(order)
while seconds > 0:
	z = 0
	while z < len(each) - 1:
		if each[z] == 'B' and each[z + 1] == 'G':
			each[z] = 'G'
			each[z + 1] = 'B'
			z = z + 2
		else:
			z = z + 1
	seconds = seconds - 1
print(''.join(each))


ini = list(map(int, input().split()))
n = ini[0]
t = ini[1]
pos = []
ini = input()
for i in ini:
	pos.append(i)
pos_of_boys = []
for i in range(n):
	if pos[i] == 'B':
		pos_of_boys.append(i)
if len(pos_of_boys) == 0:
	print(''.join(pos))
else:
	while t > 0:
		for i in range(len(pos_of_boys)):
			if pos_of_boys[i] + 1 < n and pos[pos_of_boys[i] + 1] == 'G':
				pos[pos_of_boys[i]] = 'G'
				pos[pos_of_boys[i] + 1] = 'B'
				pos_of_boys[i] += 1
		t -= 1
	print(''.join(pos))


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
(n, t) = read_ints()
queue = list(input().strip())

def solve(a: list, t: int) -> int:
	n = len(a)
	for j in range(t):
		i = 0
		while i < n - 1:
			if a[i] == 'B' and a[i + 1] == 'G':
				(a[i], a[i + 1]) = (a[i + 1], a[i])
				i = i + 1
			i = i + 1
	return ''.join(a)
print(solve(queue, t))


(n, a) = map(int, input().split())
s = list(input())

def que(s):
	arr = []
	for i in range(n):
		if len(s) > 1:
			if s[0] == 'B' and s[1] == 'G':
				arr.append(s[1])
				arr.append(s[0])
				del s[1]
				del s[0]
			else:
				arr.append(s[0])
				del s[0]
		elif len(s) == 1:
			arr.append(s[0])
			del s[0]
	return arr
for i in range(a):
	s = que(s)
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	changed = []
	for p in range(n - 1):
		if s[p] == 'B' and s[p + 1] == 'G' and (p not in changed):
			changed.append(p + 1)
	for i in changed:
		s[i] = 'B'
		s[i - 1] = 'G'
print(''.join(s))


(a, b) = map(int, input().split())
c = input()
s = ''
for j in range(b):
	for i in range(a):
		if c[i:i + 2] == 'BG':
			s += 'GB'
		elif c[i - 1:i + 1] == 'BG':
			pass
		else:
			s += c[i]
	c = s
	s = ''
print(c)


(n, c) = map(int, input().split())
s = input()
s = list(s)
while c != 0:
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
	c -= 1
print(''.join(s))


(x, y) = map(int, input().split())
str1 = str(input())
l = []
count = 0
c = 0
for i in str1:
	l.append(i)
while c != y:
	count += 1
	if count % 2 != 0:
		w = []
		w = l.copy()
		for i in range(1, x):
			if l[i] == 'G' and l[i - 1] == 'B':
				w[i - 1] = 'G'
				w[i] = 'B'
	else:
		l = []
		l = w.copy()
		for i in range(1, x):
			if w[i] == 'G' and w[i - 1] == 'B':
				l[i - 1] = 'G'
				l[i] = 'B'
	c += 1
if count % 2 != 0:
	for i in w:
		print(i, end='')
else:
	for i in l:
		print(i, end='')


import sys
(n, t) = map(int, input().split())
sQueue = input().strip()
for sec in range(t):
	flag = False
	for i in range(n):
		if flag:
			flag = False
			continue
		if sQueue[i] == 'B' and i != n - 1 and (sQueue[i + 1] == 'G'):
			sQueue = sQueue[:i] + sQueue[i + 1] + sQueue[i] + sQueue[i + 2:]
			flag = True
print(sQueue)


(children, time) = [int(i) for i in input().split()]
queue = list(input())
while time > 0:
	didSwap = False
	for (i, child) in enumerate(queue):
		if didSwap:
			didSwap = False
			continue
		elif i == 0:
			continue
		elif queue[i] == 'G' and queue[i - 1] == 'B':
			(queue[i - 1], queue[i]) = (queue[i], queue[i - 1])
			didSwap = True
	time = time - 1
print(''.join(queue))


def main():
	(n, t) = [int(i) for i in input().split(' ')]
	s = input()
	for j in range(t):
		s_ = ''
		i = 0
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				s_ = s_ + 'GB'
				i += 1
			else:
				s_ = s_ + s[i]
			i += 1
		if len(s_) != len(s):
			s_ = s_ + s[n - 1]
		s = s_
	print(s_)
main()


(n, t) = map(int, input().split())
order = str(input())
list_ = list(order)
i: int = 1
while i <= t:
	j: int = 0
	while j <= n - 2:
		if list_[j] == 'B' and list_[j + 1] == 'G':
			list_[j] = 'G'
			list_[j + 1] = 'B'
			j = j + 1
		j = j + 1
	i = i + 1
sol = ''
print(sol.join(list_))


(n, t) = map(int, input().split())
queque = list(input())
queque_modified = queque.copy()
for i in range(t):
	for j in range(1, len(queque)):
		if queque[j] == 'G' and queque[j - 1] == 'B':
			(queque_modified[j], queque_modified[j - 1]) = (queque[j - 1], queque[j])
	queque = queque_modified.copy()
print(''.join(queque_modified))


from functools import reduce
(n, t) = map(int, input().split())
k = input()
l = list(k)
for j in range(t):
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 2
		else:
			i += 1
print(reduce(lambda x, y: x + y, l))


(n, t) = map(int, input().split())
queue = list(input())
for i in range(t):
	move = set()
	for point in range(len(queue) - 1):
		if queue[point] == 'B' and queue[point + 1] == 'G' and (point not in move):
			(queue[point], queue[point + 1]) = (queue[point + 1], queue[point])
			move.add(point + 1)
print(''.join(queue))


x = [int(i) for i in input().split()]
(n, t) = (x[0], x[1])
x = input()
s = []
for i in x:
	if i == 'B':
		s.append(0)
	else:
		s.append(1)

def change(s):
	i = 0
	while i < len(s) - 1:
		if s[i] == 0 and s[i + 1] == 1:
			s[i] = 1
			s[i + 1] = 0
			i += 2
		else:
			i += 1
	return s
for i in range(t):
	s = change(s)
for i in s:
	if i == 0:
		print('B', end='')
	else:
		print('G', end='')


(x, y) = list(map(int, input().split()))
inp = input()
linp1 = list(inp)
m = 0
while m < y:
	temp = linp1
	i = 0
	while i < len(inp) - 1:
		if temp[i] == 'B' and temp[i + 1] == 'G':
			(linp1[i], linp1[i + 1]) = (linp1[i + 1], linp1[i])
			i += 1
		i += 1
	m += 1
print(''.join(linp1))


a = input()
a = a.split()
n = int(a[0])
t = int(a[1])
fila = input()
fila = list(fila)
while t > 0:
	camb = []
	for i in range(0, n - 1):
		if fila[i] == 'B' and fila[i + 1] == 'G':
			camb.append(i)
	for i in camb:
		fila[i] = 'G'
		fila[i + 1] = 'B'
	t -= 1
print(''.join(fila))


def queue_at_the_school():
	(number, time) = map(int, input().split())
	queue = list(input())
	i = 0
	while i < time:
		idx = 0
		while idx < len(queue) - 1:
			if queue[idx] == 'B' and queue[idx + 1] == 'G':
				queue[idx] = 'G'
				queue[idx + 1] = 'B'
				idx += 2
			else:
				idx += 1
		i += 1
	print(''.join(queue))
	return
queue_at_the_school()


def ans(arr, t):
	while t:
		i = 0
		while i < n - 1:
			if arr[i] == 'B' and arr[i + 1] == 'G':
				(arr[i], arr[i + 1]) = ('G', 'B')
				i += 1
			i += 1
		t -= 1
	return arr
nt = list(map(int, input().strip().split()))
(n, t) = (nt[0], nt[1])
s = list(input())
print(''.join(ans(s, t)))


(n, t) = map(int, input().split())
str1 = input()
i = 0
for kk in range(0, t):
	ans = ''
	i = 0
	while i < len(str1):
		if str1[i] == 'B' and (i + 1 < len(str1) and str1[i + 1] == 'G'):
			ans += 'GB'
			i += 2
		else:
			ans += str1[i]
			i += 1
	str1 = ans
print(str1)


(n, r) = map(int, input().rstrip().split())
q = input()
qlist = list(q)
qclist = qlist[:]
for i in range(1, r + 1):
	j = 0
	qlist = qclist[:]
	while j < n - 1:
		if qlist[j] == 'B' and qlist[j + 1] == 'G':
			qclist[j] = 'G'
			qclist[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(qclist))


(n, t) = map(int, input().split())
s = input()
boolean = False
sp = []
for l in s:
	sp.append(l)
time = 0
while time < t:
	for k in range(n - 1):
		if boolean:
			boolean = False
			continue
		if sp[k] == 'B' and sp[k + 1] == 'G':
			sp[k] = 'G'
			sp[k + 1] = 'B'
			boolean = True
	boolean = False
	time += 1
print(''.join(sp))


(x, y) = map(int, input().split(' '))
l = input()
p = []
for i in l:
	p.append(i)
for _ in range(y):
	i = 0
	while i < x:
		if i + 1 < x:
			if p[i] == 'B' and p[i + 1] == 'G':
				p[i] = 'G'
				p[i + 1] = 'B'
				i = i + 1
		i = i + 1
print(*p, sep='')


def Cambiar(A):
	NA = []
	NA = NA + [A[1]]
	NA = NA + [A[0]]
	return NA

def Cadena(A):
	NC = ''
	for K in range(len(A)):
		NC = NC + str(A[K])
	return NC

def Hacer(A):
	if str(A[0]) == 'B' and str(A[1]) == 'G':
		return 1
	else:
		return 0

def Retazo(A, Po, Pf):
	NA = []
	K = Po
	while K < Pf + 1:
		NA = NA + [A[K]]
		K = K + 1
	return NA

def Arreglo(A):
	NA = []
	for K in range(len(A)):
		X = str(A[K])
		NA = NA + [X]
	return NA

def Nuevo(A):
	Cad = ''
	A = A + ['X']
	K = 0
	while K < len(A) - 1:
		X = Retazo(A, K, K + 1)
		Y = Hacer(X)
		if Y == 1:
			Cad = Cad + Cadena(Cambiar(X))
			K = K + 2
		else:
			Cad = Cad + str(A[K])
			K = K + 1
	return Cad
Datos = input('')
Datos = Datos.split()
N = int(Datos[0])
T = int(Datos[1])
F = input('')
for K in range(T):
	NF = Arreglo(F)
	Res = Nuevo(NF)
	F = Arreglo(Res)
print(Res)


def z(a):
	return a[::-1]
(n, t) = map(int, input().split())
a = input()
a = list(a)
for i in range(t):
	j = 0
	while j < n - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			a[j:j + 2] = z(a[j:j + 2])
			j = j + 2
		else:
			j = j + 1
for i in range(n):
	print(a[i], end='')


a = input().split(' ')
n = int(a[0])
t = int(a[1])
Std = input()
for i in range(0, t):
	Std = Std.replace('BG', 'GB')
print(Std)


(n, k) = map(int, input().split())
initial = str(input())
for i in range(k):
	initial = initial.replace('BG', 'GB')
print(initial)


(a, b) = input().split()
a = int(a, 10)
b = int(b, 10)
s = input()
s1 = list(s)
for j in range(b):
	k = 0
	while k < len(s) - 1:
		if s1[k] == 'B' and s1[k + 1] == 'G':
			s1[k] = 'G'
			s1[k + 1] = 'B'
			k = k + 2
		else:
			k = k + 1
for i in range(len(s1)):
	print(s1[i], end='')


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, t) = map(int, input().split(' '))
s = input()
while t:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


(n, t) = [int(x) for x in input().split()]
s = list(input())
for time in range(t):
	i = 1
	while i < n:
		if s[i - 1] == 'B' and s[i] == 'G':
			(s[i - 1], s[i]) = (s[i], s[i - 1])
			i += 2
			if i > n:
				break
		else:
			i += 1
s = ''.join(s)
print(s)


s = input().split()
m = input()
l = []
k = []
l.extend(m)
k.extend(m)
for i in range(0, int(s[1])):
	l.extend(k)
	for j in range(1, int(s[0])):
		if l[j] == 'G' and l[j - 1] == 'B':
			k[j] = 'B'
			k[j - 1] = 'G'
	l.clear()
for i in k:
	print(i, end='')


(a, b) = map(int, input().split())
l = list(input())
t = l[:]
for i in range(b):
	l = t[:]
	for k in range(1, len(l)):
		if l[k] == 'G':
			if l[k - 1] == 'B':
				(t[k - 1], t[k]) = (t[k], t[k - 1])
print(''.join(t))


(n, t) = map(int, input().split())
line = input()

def move(line):
	n = -1
	ls = []
	do = True
	while do:
		n = line.find('BG', n + 1)
		if n == -1:
			do = False
		else:
			ls.append(n)
	for i in ls:
		line = line[:i] + 'GB' + line[i + 2:]
	return line
for i in range(t):
	line = move(line)
print(line)


(count, time) = [int(x) for x in input().split()]
line = list(input())
for c in range(time):
	ix = 0
	while ix < count - 1:
		if line[ix] == 'B' and line[ix + 1] == 'G':
			line[ix] = 'G'
			line[ix + 1] = 'B'
			ix += 2
		else:
			ix += 1
print(''.join(line))


[n, t] = [int(x) for x in input().split()]
queue = list(input())
i = 0
while t > 0:
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
			continue
		i += 1
	t -= 1
q = ''.join(queue)
print(q)


Ip = input()
String = input()
(Length, time) = Ip.split(' ')
(Length, time) = (int(Length), int(time))
String = list(String)
for i in range(time):
	j = 0
	while j < len(String) - 1:
		if String[j] == 'B' and String[j + 1] == 'G':
			String[j] = 'G'
			String[j + 1] = 'B'
			j += 2
		else:
			j += 1
print(''.join(String))


def int_raw():
	return int(input())

def ss_raw():
	return input().split()

def ints_raw():
	return list(map(int, ss_raw()))
(N, T) = ints_raw()
S = input()

def main():
	l = list(S)
	for t in range(T):
		i = 0
		while i < N - 1:
			if l[i] == 'B' and l[i + 1] == 'G':
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				i += 2
			else:
				i += 1
	return ''.join(l)
print(main())


(a, b) = [int(x) for x in input().split()]
l = list(input())
for r in range(b):
	i = 0
	while i < a - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(l))


(n, t) = map(int, input().split())
lst = list(input())
for i in range(t):
	j = 0
	while j < n:
		if j < n - 1 and lst[j] < lst[j + 1]:
			temp = lst[j]
			lst[j] = lst[j + 1]
			lst[j + 1] = temp
			j = j + 2
		elif j > n:
			break
		else:
			j = j + 1
print(''.join(lst))


na = input().split(' ')
t = int(na[1])
ppl = input()
ppll = []
for i in ppl:
	ppll.append(i)
for y in range(t):
	x = 0
	while x < len(ppll) - 1:
		if ppll[x] == 'B' and ppll[x + 1] == 'G':
			tmp = ppll[x]
			ppll[x] = ppll[x + 1]
			ppll[x + 1] = tmp
			x += 1
		x += 1
print(''.join(ppll))


def getLines(num):
	inputLines = []
	for i in range(0, num):
		line = input()
		if line:
			inputLines.append(line)
		else:
			break
	return inputLines

def notZeroPow(num, p):
	return True if num >= 1 and num <= pow(10, p) else False
lines = getLines(2)
t = int(lines[0].split()[1])
s = []
for c in lines[1]:
	s.append(c)
con = False
for n in range(t):
	for (i, c) in enumerate(s):
		if con:
			con = False
			continue
		if i + 1 < len(s):
			if c == 'B' and s[i + 1] == 'G':
				s[i] = 'G'
				s[i + 1] = 'B'
				con = True
final = ''
for c in s:
	final += c
print(final)


(l, s) = list(map(int, input().split()))
b = input()
while s:
	b = b.replace('BG', 'GB')
	s -= 1
print(b)


(n, t) = input().split()
n = int(n)
t = int(t)
initial = input()
final = ''
initial_queue = []
for i in initial:
	initial_queue.append(i)
position = []
for n in range(t):
	position = []
	for j in range(len(initial_queue) - 1):
		if initial_queue[j] == 'B' and initial_queue[j + 1] == 'G':
			position.append(j)
		else:
			continue
	for k in position:
		initial_queue[k] = 'G'
		initial_queue[k + 1] = 'B'
for i in initial_queue:
	final += i
print(final)


(n, t) = map(int, input().split())
lt = input()
for i in range(1, t + 1):
	lt = lt.replace('BG', 'GB')
print(lt)


(m, n) = map(int, input().split())
l = []
str = input()
l.append(str)
y = 0
for i in range(n):
	x = l[y].replace('BG', 'GB')
	l.append(x)
	y += 1
print(l[n])


(n, m) = input().split()
n = int(n)
m = int(m)
a = input()
a = a.lower()
for i in range(m):
	j = 0
	z = ''
	while j < n:
		t = 0
		if a[j] == 'b' and j + 1 < n and (a[j + 1] == 'g'):
			z += 'gb'
			j += 2
		else:
			z += a[j]
			j += 1
	a = z
a = a.upper()
print(a)


(n, t) = input().split()
(n, t) = (int(n), int(t))
s = list(input())
l = len(s)
while t > 0:
	j = 0
	while j < l - 1:
		if s[j] < s[j + 1]:
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
	t -= 1
print(''.join(s))


nt = list(map(int, input().rstrip().split()))
(n, t) = nt
seq = input()
for j in range(t):
	i = 0
	while i <= len(seq) - 2:
		if seq[i] == 'B' and seq[i + 1] == 'G':
			seq = seq[:i] + seq[i:i + 1].replace('B', 'G') + seq[i + 1:]
			seq = seq[:i + 1] + seq[i + 1:i + 2].replace('G', 'B') + seq[i + 2:]
			i += 2
		else:
			i += 1
print(seq)


def solve():
	(n, t) = input().split()
	(n, t) = (int(n), int(t))
	queue = [c for c in input()]
	for _ in range(t):
		i = 0
		while i < n - 1:
			if queue[i] == 'B' and queue[i + 1] == 'G':
				queue[i] = 'G'
				queue[i + 1] = 'B'
				if i < n - 2:
					if queue[i + 2] == 'G':
						i += 1
			i += 1
	print(''.join(queue))
solve()


n = input().split()
s = input()
z = 0
a = ''
e = 0
if int(len(s)) == 1:
	e = 1
for i in range(0, int(n[1])):
	for j in range(0, len(s) - 1 + e):
		if e == 1:
			break
		if s[j] == 'B' and s[j + 1] == 'G':
			a += s[j + 1]
			z = -1
		else:
			a += s[j + z]
			z = 0
	if e == 1:
		print(s)
		break
	a += s[j + z + 1]
	s = a
	z = 0
	if i != int(n[1]) - 1:
		a = ''
print(a)


(n, m) = [int(x) for x in input('').split()]
s = input('')
l = list(s)
i = 1
j = 1
while i <= m:
	j = 1
	while j < n:
		if l[j] == 'G' and l[j - 1] == 'B':
			l[j - 1] = 'G'
			l[j] = 'B'
			j += 2
		else:
			j += 1
	i += 1
s = ''
s = ''.join(l)
print(s)


(n, t) = map(int, input().split())
stri = input()
arr = []
for i in stri:
	arr.append(i)
d = 0
while d < t:
	i = 0
	j = 1
	while j < len(arr):
		if arr[i] == 'B' and arr[j] == 'G':
			(arr[i], arr[j]) = (arr[j], arr[i])
			i = j + 1
			j += 2
		else:
			i += 1
			j += 1
	d += 1
for i in arr:
	print(i, end='')


(n, t) = input().split(' ')
n = int(n)
t = int(t)
s = input()
s = list(s)
for i in range(t):
	j = 0
	while True:
		if j >= n:
			break
		if s[j] == 'B' and j + 1 < n and (s[j + 1] == 'G'):
			s[j] = 'G'
			s[j + 1] = 'B'
			j = j + 2
		else:
			j = j + 1
print(''.join(s))


(n, t) = input().split()
w = input()
for x in range(int(t)):
	w = w.replace('BG', 'GB')
print(w)


inp = input().split(' ')
t = int(inp[1])
position = input()
position_list = []
for c in position:
	position_list.append(c)
for i in range(0, t):
	j = len(position_list) - 2
	while j >= 0:
		if position_list[j] == 'B' and position_list[j + 1] == 'G':
			position_list[j] = 'G'
			position_list[j + 1] = 'B'
			j -= 1
		j -= 1
print(''.join(position_list))


a = input().split()
n = int(a[0])
t = int(a[1])
q = input()
for i in range(0, t):
	mark = set()
	for j in range(0, n - 1):
		if q[j] == 'B' and q[j + 1] == 'G':
			mark.add(j)
	for j in range(0, n):
		if j in mark:
			string_list = list(q)
			string_list[j] = 'G'
			string_list[j + 1] = 'B'
			q = ''.join(string_list)
print(q)


(n, t) = list(map(int, input().split()))
q = input()
while t:
	q = q.replace('BG', 'GB')
	t -= 1
print(q)


(n, t) = map(int, input().split())
st = input()
mas = []
for i in st:
	mas.append(i)
x = 1
while t != 0:
	t -= 1
	for i in range(0, len(mas) - 1):
		if mas[i] == 'B' and x == 0:
			x = 1
		elif mas[i] == 'B' and mas[i + 1] == 'G' and (x == 1):
			mas[i] = 'G'
			mas[i + 1] = 'B'
			x = 0
		else:
			x = 1
	x = 1
for i in mas:
	print(i, end='')


(n, s) = map(int, input().split())
a = str(input())
if s != 0:
	for i in range(s):
		if a.find('BG') != -1:
			a = a.replace('BG', 'GB')
print(a)


def school(n, t, s):
	s = list(s)
	for i in range(t):
		a = [0] * len(s)
		for j in range(len(s) - 1):
			if s[j] == 'B' and s[j + 1] == 'G' and (a[j] == 0):
				a[j + 1] = 1
				(s[j], s[j + 1]) = (s[j + 1], s[j])
	return ''.join(s)
(n, t) = map(int, input().split())
s = input()
print(school(n, t, s))


(n, t) = map(int, input().split())
q = list(input())
for i in [0] * t:
	for x in range(n):
		try:
			if q[x] == 'B' and q[x + 1] == 'G':
				q[x] = 'g'
				q[x + 1] = 'b'
		except:
			pass
	q = ''.join(q)
	q = q.upper()
	q = list(q)
print(''.join(q))


from collections import *
from bisect import *
from heapq import *
from fractions import *
import sys
input = sys.stdin.readline
t = 1
while t:
	t -= 1
	(n, tt) = map(int, input().split())
	a = input().rstrip('\n')
	a = list(a)
	for i in range(tt):
		(g, b) = (0, 0)
		j = 0
		while j < n - 1:
			if a[j] == 'B' and a[j + 1] == 'G':
				(a[j], a[j + 1]) = (a[j + 1], a[j])
				j += 2
			else:
				j += 1
	print(''.join(a))


(a, b) = map(int, input().strip().split())
s = input()
s = list(s)
for m in range(b):
	x = 0
	for i in range(0, a):
		try:
			if s[x] == 'B' and s[x + 1] == 'G':
				(s[x], s[x + 1]) = (s[x + 1], s[x])
				x += 2
			else:
				x += 1
		except IndexError:
			break
print(''.join(s))


(l, n) = map(int, input().split())
s = input()
for _ in range(n):
	s = s.replace('BG', 'GB')
print(s)


(a, b) = map(int, input().split())
x = input()
for _ in range(b):
	count = 0
	y = ''
	for i in range(0, a - 1):
		if x[i] == 'B' and x[i + 1] == 'G' and (count == 0):
			y += 'G'
			y += 'B'
			count = 1
		elif count == 1:
			count = 0
			continue
		else:
			y += x[i]
	if count == 0:
		y += x[-1]
	x = y
print(x)


def bg(n, t, s):
	l = []
	for i in range(0, len(s)):
		l.append(s[i])
	if l.count('B') == 0:
		print(s)
	else:
		for i in range(0, t):
			c = l.count('B')
			lb = []
			ind = l.index('B')
			lb.append(ind)
			for j in range(1, c):
				indi = l.index('B', ind + 1)
				lb.append(indi)
				ind = indi
			if lb[-1] == len(l) - 1:
				for k in lb[:-1]:
					if l[k + 1] == 'G':
						temp = l[k + 1]
						l[k + 1] = l[k]
						l[k] = temp
			else:
				for k in lb:
					if l[k + 1] == 'G':
						temp = l[k + 1]
						l[k + 1] = l[k]
						l[k] = temp
		for j in range(0, len(l)):
			print(l[j], end='')
(n, t) = map(int, input().split())
s = input()
bg(n, t, s)


(a, b) = [int(x) for x in input().split()]
c = list(input())
for x in range(b):
	d = []
	for i in range(a - 1):
		if c[i] == 'B' and c[i + 1] == 'G':
			d.append(i)
	for j in range(len(d)):
		c[d[j]] = 'G'
		c[d[j] + 1] = 'B'
s = ''
print(s.join(c))


(e, t) = map(int, input().split())
n = list(input())
for i in range(t):
	s = 0
	for i in range(len(n) - 1):
		if n[i] == 'B' and n[i + 1] == 'G' and (s == 0):
			n[i] = 'G'
			n[i + 1] = 'B'
			s = 1
		else:
			s = 0
o = ''
for i in n:
	o = o + i
print(o)


def boy_girl(num, time, bg):
	bg_array = list(bg)
	i = 0
	while i < time:
		x = 0
		for j in range(len(bg_array) - 1):
			if x >= len(bg_array) - 1:
				break
			if bg_array[x] == 'B' and bg_array[x + 1] == 'G':
				bg_array[x] = 'G'
				bg_array[x + 1] = 'B'
				x += 2
			else:
				x += 1
		i += 1
	bg = ''.join(bg_array)
	return bg
(number, time) = map(int, input().split())
boys_girls = input()
print(boy_girl(number, time, boys_girls))


nt = input().strip().split(' ')
n = nt[0]
t = int(nt[1])
str1 = input().strip()
for i in range(t):
	str1 = str1.replace('BG', 'GB')
print(str1)


n = list(map(int, input().split()))
n1 = input()
s = n1[:n[0]]
m = ' '.join(s)
p = m.split()
w = ''
for i in range(n[1]):
	w = ''
	for j in range(len(p)):
		if j != len(p) - 1:
			if p[j] == 'B' and p[j + 1] == 'G':
				w = w + 'G' + 'B'
				r = j + 1
				p.remove(p[j + 1])
				p.insert(r, 'z')
			elif p[j] != 'z':
				w += p[j]
		elif p[j] != 'z':
			w += p[j]
	v = ' '.join(w)
	p = v.split()
print(w)


def Convert(string):
	list1 = []
	list1[:0] = string
	return list1
dum = str(input())
lst = dum.split()
n = int(lst[0])
t = int(lst[1])
s = str(input())
sl = Convert(s)
running = True
while t > 0 and running == True:
	t -= 1
	d1 = 0
	running = False
	while d1 <= int(len(sl) - 2):
		if sl[d1] == 'B' and sl[d1 + 1] == 'G':
			sl[d1] = 'G'
			sl[d1 + 1] = 'B'
			running = True
			d1 += 2
		else:
			d1 += 1
for i in sl:
	print(i, end='')


(n, t) = [int(t) for t in input().split()]
line = list(input())
T = 1
while t > 0:
	while T < n:
		if line[T] == 'G' and line[T - 1] == 'B':
			line[T] = 'B'
			line[T - 1] = 'G'
			T += 2
		else:
			T += 1
	t = t - 1
	T = 1
for i in line:
	print(i, end='')


(N, T) = map(int, input().split())
A = list(input())
while T:
	i = 0
	while i < N:
		if A[i] == 'B' and i < N - 1:
			if A[i + 1] == 'G':
				A[i] = 'G'
				A[i + 1] = 'B'
				i += 1
		i += 1
	T -= 1
S = ''.join(A)
print(S)


(a, b) = list(map(int, input().split()))
x = input()
while b:
	x = x.replace('BG', 'GB')
	b -= 1
print(x)


(a, b) = map(int, input().split())
c = input()
list1 = list(c)
for i in range(b):
	j = 0
	while j < a:
		if list1[j] == 'B' and j < a - 1:
			if list1[j + 1] == 'G':
				j = j + 1
				tmp = list1[j]
				list1[j] = list1[j - 1]
				list1[j - 1] = tmp
		j = j + 1
str1 = ''.join(list1)
print(str1)


from sys import stdin
_input = stdin.readline
(_str, _list, _int, _range) = (str, list, int, range)

def solution():
	(n, t) = [_int(i) for i in _input().split()]
	arr = [i for i in _list(_input().rstrip('\n'))]
	for i in _range(t):
		j = 0
		while j < n - 1:
			if arr[j] == 'B' and arr[j + 1] == 'G':
				(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
				j += 1
			j += 1
	print(*arr, sep='')
solution()


line = list(map(int, input().split()))
queue = list(input())
n = line[0]
t = line[1]
for i in range(t):
	Nqueue = ['B'] * n
	if queue[0] == 'G':
		Nqueue[0] = 'G'
	for k in range(1, n):
		if queue[k] == 'G':
			if queue[k - 1] != 'G':
				Nqueue[k - 1] = 'G'
			else:
				Nqueue[k] = 'G'
	queue = Nqueue
print(''.join(queue))


(n, c) = list(map(int, input().split()))
line = list(input())

def isPositioned(arr):
	if arr == list('BG'):
		return 0
	else:
		return 1
arr = []
for _ in range(c):
	i = 0
	while i < len(line) - 1:
		if line[i:i + 2] == list('BG'):
			temp = line[i]
			line[i] = line[i + 1]
			line[i + 1] = temp
			i += 1
		i += 1
print(''.join(line))


(a, b) = map(int, input().split())
x = input()
t = list(x)
while b > 0:
	b = b - 1
	c = 0
	while c < a - 1:
		if t[c] == 'B' and t[c + 1] == 'G':
			t[c] = 'G'
			t[c + 1] = 'B'
			c = c + 2
		else:
			c = c + 1
s = ''
for i in range(a):
	s = s + t[i]
print(s)


(a, b) = map(int, input().split())
c = list(input())
j = 0
m = []
st = ''
for i in range(b):
	while j < a:
		if j < a - 1 and c[j] == 'B' and (c[j + 1] == 'G'):
			m += 'G'
			m += 'B'
			j += 1
		else:
			m += 'B' if c[j] == 'B' else 'G'
		j += 1
	c = m
	m = []
	j = 0
for i in range(a):
	st += str(c[i])
print(st)


s = input().split()
a = int(s[0])
b = int(s[1])
st = input()
mat = []
sat = []
hooks = 0
for i in st:
	mat.append(i)
while hooks < b:
	while len(mat) > 0:
		if len(mat) >= 2 and mat[0] == 'B' and (mat[1] == 'G'):
			sat.append(mat[1])
			sat.append(mat[0])
			del mat[1]
			del mat[0]
		else:
			sat.append(mat[0])
			del mat[0]
	mat = list(sat)
	sat = []
	hooks += 1
for i in mat:
	print(i, end='')


a = input()
a = a.split(' ')
a = [*map(int, a)]
b = input()
b = [i for i in b]
c = b
for i in range(a[1]):
	j = 0
	while j < a[0] - 1:
		if b[j] == 'B' and b[j + 1] == 'G':
			try:
				temp = c[j]
				c[j] = c[j + 1]
				c[j + 1] = temp
				j += 1
			except IndexError:
				pass
		j += 1
print(''.join(c))


(n, t) = map(int, input().split())
string = input()
strr = [char for char in string]
if len(strr) == 1:
	print(string)
else:
	for _ in range(t):
		i = 0
		while True:
			if strr[i] == 'B' and strr[i + 1] == 'G':
				strr[i] = 'G'
				strr[i + 1] = 'B'
				i = i + 2
			else:
				i = i + 1
			if i == n - 1:
				break
			if i == n:
				break
	fin = ''
	for i in strr:
		fin = fin + i
	print(fin)


arr = list(map(int, input().split()))
n = list(input())
p = n
k = 0
for i in range(arr[1]):
	while k < arr[0] - 1:
		if p[k] == 'B' and p[k + 1] == 'G':
			n[k] = 'G'
			n[k + 1] = 'B'
			k += 2
		else:
			k += 1
	p = n
	k = 0
print(*n, sep='')


(n, t) = map(int, input().split())
data = [i for i in input()]
k = 1
while k <= t:
	i = 0
	while i < n - 1:
		if data[i] == 'B' and data[i + 1] == 'G':
			(data[i], data[i + 1]) = ('G', 'B')
			i += 1
		i += 1
	k += 1
print(*data, sep='')


n = list(map(int, input().split()))
st = input()
count = 0
for i in range(n[0]):
	if count == n[1]:
		break
	elif 'BG' in st:
		st = st.replace('BG', 'GB')
		count = count + 1
print(st)


(leng, time) = input().split()
b = input()
for _ in range(int(time)):
	s = b.replace('BG', 'GB')
	b = s
print(b)


def swap(s):
	s = list(s)
	checked = []
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G' and (i not in checked):
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			checked.append(i)
			checked.append(i + 1)
	return ''.join(s)
(count, t) = input().split()
queue = input()
for i in range(int(t)):
	queue = swap(queue)
print(queue)


(n, t) = map(int, input().split())
m = input()
c = 0
for j in range(t):
	for i in range(len(m) - 1):
		if m[i] == 'B' and m[i + 1] == 'G':
			c += 1
	m = m.replace('BG', 'GB', c)
print(m)


def swap(x, y):
	global b
	b[x] = 'G'
	b[y] = 'B'
(n, t) = map(int, input().split())
b = list(input())
a = ''
j = 0
for i in range(t):
	while j < len(b) - 1:
		if b[j] == 'B' and b[j + 1] == 'G':
			(b[j], b[j + 1]) = (b[j + 1], b[j])
			j = j + 2
		else:
			j += 1
	j = 0
print(''.join(b))


(n, t) = list(map(int, input().split()))
s = input()
result = [char for char in s]
for i in range(t):
	j = 0
	while j < len(result) - 1:
		if result[j] == 'B' and result[j + 1] == 'G':
			(result[j], result[j + 1]) = (result[j + 1], result[j])
			j += 2
		else:
			j += 1
print(''.join(result))


nums = input()
line = input()
lt = []
(n, t) = list(map(int, nums.split()))
for i in range(t):
	line = line.replace('BG', 'GB')
print(line)


(n, t) = map(int, input().split(' '))
q = input()
klist = list((i for i in q))
for _ in range(t):
	i = 0
	while i < n - 1:
		if klist[i] == 'B' and klist[i + 1] == 'G':
			(klist[i], klist[i + 1]) = (klist[i + 1], klist[i])
			i += 1
		i += 1
print(''.join(klist))


(n, t) = [int(x) for x in input().split()]
s = list(input())
while t > 0:
	t -= 1
	x = 0
	while x < len(s):
		if x == len(s) - 1:
			break
		if s[x] == 'B' and s[x + 1] == 'G':
			(s[x], s[x + 1]) = (s[x + 1], s[x])
			x += 2
			continue
		x += 1
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input().strip())
for i in range(t):
	skip = False
	for a in range(n - 1):
		if skip:
			skip = False
			continue
		if s[a] == 'B' and s[a + 1] == 'G':
			s[a] = 'G'
			s[a + 1] = 'B'
			skip = True
for g in s:
	print(g, end='')
print()


(n, t) = [int(x) for x in input().split()]
line = list(input())
for j in range(t):
	i = 0
	while i < n - 1:
		if line[i] < line[i + 1]:
			line[i] = 'G'
			line[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(line))


guys_time = list(map(int, input().split()))
queue = list(map(str, input()))
for i in range(guys_time[1]):
	k = 1
	while k < guys_time[0]:
		if queue[k - 1] == 'B' and queue[k] == 'G':
			queue[k - 1] = 'G'
			queue[k] = 'B'
			k += 1
		k += 1
print(*queue, sep='')


import math
import os
import sys
import re
import itertools
import functools
import operator
(n, t) = map(int, input().split())
s = bytearray(input(), 'ascii')
for i in range(t, 0, -1):
	j = s.find(b'BG', 0)
	while j != -1:
		(s[j], s[j + 1]) = (s[j + 1], s[j])
		j = s.find(b'BG', j + 2)
print(s.decode('ascii'))


(n, t) = map(int, input().split())
shkl = list(input())
for _ in range(t):
	chck = None
	for i in range(n - 1):
		if shkl[i] == 'B' and shkl[i + 1] == 'G' and (chck != i):
			shkl[i] = 'G'
			shkl[i + 1] = 'B'
			chck = i + 1
print(''.join(map(str, shkl)))


def main():
	(n, t) = [int(i) for i in input().split()]
	row = input()
	for _ in range(t):
		row = row.replace('BG', 'GB')
	print(row)
main()


arr = str(input()).split()
times = int(arr[1])
raw = []
for i in str(input()):
	raw.append(i)
or_raw = []
for k in raw:
	or_raw.append(k)
if len(raw) == 1:
	print(''.join(raw))
else:
	for i in range(times):
		for j in range(0, len(raw) - 1):
			if or_raw[j] == 'B' and or_raw[j + 1] == 'G':
				(raw[j], raw[j + 1]) = ('G', 'B')
		or_raw.clear()
		for k in raw:
			or_raw.append(k)
	print(''.join(or_raw))


list1 = list(map(int, input().split()))
n = list1[0]
t = list1[1]
s = list(input())
count = 0
for i in range(t):
	l = []
	for i in range(len(s)):
		if i != len(s) - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				l.append(i)
	for i in range(len(s)):
		if i in l:
			s[i] = 'G'
			s[i + 1] = 'B'
a = ''.join(map(str, s))
print(a)


import math
from collections import defaultdict, Counter, deque
INF = float('inf')

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i ** 2 <= n:
		if n % i == 0:
			return i
		i += 1
	return n

def main():
	(n, x) = map(int, input().split())
	s = list(input())
	for i in range(x):
		j = 0
		while j < n - 1:
			if s[j] == 'B' and s[j + 1] == 'G':
				(s[j], s[j + 1]) = (s[j + 1], s[j])
				j += 1
			j += 1
	print(''.join(s))
t = 1
for _ in range(t):
	main()


(qq, w) = map(int, input('').split())
q = []
a = str(input(''))
for i in a:
	if i == 'G':
		q.append(0)
	else:
		q.append(1)
for o in range(w):
	e = None
	for p in range(0, len(q) - 1):
		if q[p] == 1 and q[p + 1] == 0:
			if p is e:
				continue
			else:
				q[p] = 0
				q[p + 1] = 1
				e = p + 1
pp = ''
for i in q:
	if i == 0:
		pp = pp + 'G'
	else:
		pp = pp + 'B'
print(pp)


(n, t) = map(int, input().split())
s = list(input())
new = s[:]
for j in range(t):
	new_new = new[:]
	for i in range(n - 1):
		if new_new[i] == 'B' and new_new[i + 1] == 'G':
			new[i] = 'G'
			new[i + 1] = 'B'
print(''.join(new))


line = input()
a = input()
l = line.split()
t = int(l[1])
i = 0
while i < t:
	i += 1
	b = a.replace('BG', 'GB')
	if b == a:
		b = a
		break
	a = b
print(a)


(n, x) = map(int, input().split())
s = input()
res = ''
for _ in range(x):
	count = 0
	for i in range(n):
		try:
			if count > 0:
				count = 0
				pass
			elif s[i] == 'B' and s[i + 1] == 'G':
				res += s[i + 1]
				res += s[i]
				count += 1
			else:
				res += s[i]
				count = 0
		except:
			res += s[i]
	s = res
	res = ''
print(s)


(lenth, sec) = map(int, str(input()).split(' '))
sexes = str(input())
for _ in range(sec):
	sexes = sexes.replace('BG', 'GB')
print(sexes)


(n, t) = map(int, input().split())
val = input()
str_val = [i for i in val]
for _ in range(t):
	visit = set()
	for i in range(1, n):
		if str_val[i - 1] == 'B' and str_val[i] == 'G':
			if i - 1 in visit or i in visit:
				continue
			(str_val[i - 1], str_val[i]) = (str_val[i], str_val[i - 1])
			visit.add(i)
			visit.add(i - 1)
print(''.join(str_val))


def main(queue, t):
	q_list = list(queue)
	q_len = len(queue)
	for _ in range(t):
		i = 0
		while i < q_len - 1:
			if (q_list[i], q_list[i + 1]) == ('B', 'G'):
				(q_list[i], q_list[i + 1]) = ('G', 'B')
				i += 2
			else:
				i += 1
	return ''.join(q_list)
(n, t) = map(int, input().strip().split())
queue = input()
print(main(queue, t))


from itertools import accumulate as ac
from collections import Counter as cc
from bisect import bisect_left as bsl
from bisect import bisect as bs
from math import factorial as f
from collections import *
from itertools import *
from string import *
from bisect import *
from queue import *
from heapq import *
from math import *
from sys import *
from re import *

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
(n, m) = zzz()
arr = list(fast())
for i in range(m):
	i = 0
	while i < n:
		if i >= n - 1:
			break
		if arr[i] == 'B' and arr[i + 1] == 'G':
			arr[i] = 'G'
			arr[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(arr))


ip = input().split()
t = ip[1]
noc = ip[0]
queue_string = list(input())
i = 0
j = 0
while j < int(t):
	while i < len(queue_string):
		if queue_string[i] == 'B' and i + 1 != len(queue_string) and (queue_string[i + 1] == 'G'):
			queue_string[i] = 'G'
			queue_string[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	i = 0
	j = j + 1
print(''.join(queue_string))


(N, T) = map(int, input().split())
S = list(input())
for t in range(T):
	swap_lst = []
	for i in range(N - 1):
		if S[i] == 'B' and S[i + 1] == 'G':
			swap_lst.append(i)
	for i in swap_lst:
		(S[i], S[i + 1]) = (S[i + 1], S[i])
print(''.join(S))


a = list(map(int, input().split()))
a1 = a[0]
a2 = a[1]
b = list(input())
c = b.copy()
for i in range(a2):
	for j in range(a1 - 1):
		if b[j] == 'B' and b[j + 1] == 'G':
			(c[j], c[j + 1]) = (c[j + 1], c[j])
	b = c.copy()
for i in range(a1):
	print(b[i], end='')


(n, t) = map(int, input().split())
queue = list(input())
j = 0
while j < t:
	i = 0
	while i < len(queue) - 1:
		if queue[i:i + 2] == ['B', 'G']:
			queue[i:i + 2] = ['G', 'B']
			i += 2
		else:
			i += 1
	j += 1
print(''.join(queue))


z = list(map(int, input().split()))
x = list(input())
for i in range(z[1]):
	o = 0
	while o < len(x):
		if o < len(x) - 1 and x[o] == 'B' and (x[o + 1] == 'G'):
			(x[o], x[o + 1]) = (x[o + 1], x[o])
			o += 2
		else:
			o += 1
		if o > len(x) - 1:
			break
print(''.join(x))


inp = input()
n = int(inp.split()[0])
t = int(inp.split()[1])
s = input()
sout = ''
for _ in range(0, t):
	i = 0
	sout = ''
	while i < len(s):
		if i < len(s) - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			sout += 'G'
			sout += 'B'
			i += 2
		else:
			sout += s[i]
			i += 1
	s = sout
print(sout)


(m, n) = map(int, input().split())
l = input()
s = [term for term in l]
for _ in range(n):
	j = 0
	while j < m - 1:
		sub = s[j:j + 2]
		if sub[0] == 'B' and sub[1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 2
		else:
			j += 1
i = ''
i = i.join(s)
print(i)


(n, t) = map(int, input().split())
s = input()
L = []
for i in s:
	L.append(i)
while t:
	t -= 1
	i = 0
	while i < n - 1:
		if L[i] == 'B' and L[i + 1] == 'G':
			L[i] = 'G'
			L[i + 1] = 'B'
			i += 1
		i += 1
s = ''
for i in L:
	s += i
print(s)


x = input()
x = [int(i) for i in x.split(' ')]
n = x[1]
y = input()
while n != 0:
	i = 0
	res = ''
	if len(y) == 1:
		res = y
		break
	while i in range(len(y) - 1) and len(y) != 1:
		if y[i] == 'B' and y[i + 1] == 'G':
			res = res + y[i + 1] + y[i]
			i = i + 2
		else:
			res = res + y[i]
			i = i + 1
		if i == len(y) - 1:
			res = res + y[i]
			break
	n = n - 1
	y = res
print(res)


(n, t) = input().split(' ')
(n, t) = (int(n), int(t))
s = input()
l = list(s)
flag = 0
while t:
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			flag = 1
			(l[i], l[i + 1]) = (s[i + 1], s[i])
	if flag == 0:
		break
	t -= 1
	s = l.copy()
print(*l, sep='')


(N, T) = map(int, input().split())
s = input()
t = list(s)
for i in range(T):
	j = 0
	while j < N - 1:
		if t[j] == 'B' and t[j + 1] == 'G':
			temp = t[j]
			t[j] = t[j + 1]
			t[j + 1] = temp
			j += 2
		else:
			j += 1
			continue
print(''.join(t))


a = list(map(int, input().split()))
c = input()
b = [i for i in c]
for k in range(a[1]):
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 2
		elif b[i] == 'B':
			i += 1
		elif b[i] != 'B':
			i += 1
c = ''.join((i for i in b))
print(c)


s0 = input()
s2 = s0.split(' ')
n = int(s2[0])
t = int(s2[1])
s = input()
s1 = list(s)
j = 0
for i in range(t):
	while j <= n - 2:
		if s1[j] == 'B' and s1[j + 1] == 'G':
			(s1[j], s1[j + 1]) = (s1[j + 1], s1[j])
			j += 2
		else:
			j += 1
	j = 0
x = ''.join(s1)
print(x)


(k, t) = input().split()
k = int(k)
t = int(t)
s = input()
flag = 1
for j in range(t):
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G' and flag:
			s = s[:i] + 'G' + 'B' + s[i + 2:]
			flag = 0
		else:
			flag = 1
	flag = 1
print(s)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	a = list(s)
	for i in range(n - 1):
		if s[i:i + 2] == 'BG':
			a[i:i + 2] = ['G', 'B']
	s = ''.join(a)
print(s)


(num_children, time) = map(int, input().split())
queue = list(input())
for _ in range(time):
	new_queue = []
	pos = 0
	while pos < num_children - 1:
		if queue[pos] == 'G' or queue[pos + 1] == 'B':
			new_queue.append(queue[pos])
			pos += 1
		else:
			new_queue.append(queue[pos + 1])
			new_queue.append(queue[pos])
			pos += 2
	if len(new_queue) < len(queue):
		new_queue.append(queue[-1])
	queue = new_queue
print(''.join(queue))


(n, m) = input().split()
n = int(n)
m = int(m)
s = input()
s = list(s)
f = [0] * n
for j in range(m):
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			f[i] = 'G'
			f[i + 1] = 'B'
	for k in range(len(s)):
		if f[k] == 0:
			f[k] = s[k]
		s[k] = f[k]
for l in range(len(f)):
	print(f[l], end='')


(n, t) = map(int, input().split())
s = list(input())
b = []
b = s.copy()
for i in range(t):
	for x in range(len(s) - 1):
		if (s[x] == 'B') & (s[x + 1] == 'G'):
			a = b[x]
			b[x] = b[x + 1]
			b[x + 1] = a
	s = b.copy()
print(''.join(b))


(n, l) = [int(x) for x in input().split()]
ab = input()
for i in range(l):
	ab = ab.replace('BG', 'GB')
print(ab)


(n, t) = input().split()
s = input()
n = int(n)
t = int(t)
sl = list(s)
i = 0
while i < t:
	j = 1
	while j < n:
		if sl[j - 1] == 'B' and sl[j] == 'G':
			(sl[j - 1], sl[j]) = (sl[j], sl[j - 1])
			j = j + 2
		else:
			j = j + 1
	i = i + 1
sn = ''.join(sl)
print(sn)


x = input().split()
s = input()
n = int(x[0])
t = int(x[1])
s1 = ['' for i in range(n)]
for i in range(n):
	s1[i] = s[i]
for i in range(t):
	s2 = ['' for i in range(n)]
	for i in range(n):
		s2[i] = s1[i]
	for k in range(n - 1):
		if s1[k] == 'B' and s1[k + 1] == 'G':
			(s2[k], s2[k + 1]) = ('G', 'B')
	s1 = s2
s = ''
for i in range(n):
	s = s + s1[i]
print(s)


(_, time) = [int(x) for x in input().strip().split()]
queue = input().strip()
for _ in range(time):
	queue = queue.replace('BG', 'GB')
print(queue)


from sys import stdin
from sys import stdout
(n, t) = map(int, stdin.readline().split())
s = list(stdin.readline())
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			j += 1
		j += 1
stdout.write(''.join(s))


(n, k) = [int(x) for x in input().split()]
s = list(input())
for _ in range(k):
	new_s = s[:]
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			new_s[i] = 'G'
			new_s[i + 1] = 'B'
	s = new_s[:]
print(''.join(s))


(n, t) = list(map(int, input().split()))
arrangement = list(input())
while t != 0:
	pos = 0
	while pos < n - 1:
		if arrangement[pos] == 'B' and arrangement[pos + 1] == 'G':
			(arrangement[pos], arrangement[pos + 1]) = (arrangement[pos + 1], arrangement[pos])
			pos += 2
		else:
			pos += 1
	t -= 1
ans = ''
for i in arrangement:
	ans += str(i)
print(ans)


a = list(map(int, input().split(' ')))
b = str(input())
b = list(b)
for i in range(0, a[1]):
	t = 0
	for j in range(0, len(b) - 1):
		if t == 1:
			t = 0
			continue
		if b[j] == 'B' and b[j + 1] == 'G':
			(b[j], b[j + 1]) = (b[j + 1], b[j])
			t = 1
print(''.join(b))


(n, t) = list(map(int, input().split()))
q = input()
m = []
for i in q:
	if i == 'B':
		m.append(1)
	else:
		m.append(0)
for t in range(t):
	i = 1
	while i < n:
		if m[i] < m[i - 1]:
			(m[i], m[i - 1]) = (m[i - 1], m[i])
			i = i + 1
		i = i + 1
s = ''
for i in m:
	if i == 1:
		s = s + 'B'
	else:
		s = s + 'G'
print(s)


communism = input()
clist = communism.split(' ')
line = input()
seconds = int(clist[1])
linelength = clist[0]
newline = line[:]
for second in range(seconds):
	newline = newline.replace('BG', 'GB')
print(newline)


(n, t) = [int(i) for i in input().split()]
string = input()
break_flag = 0
if len(string) == 1:
	break_flag = 1
	print(string)
else:
	for loop in range(t):
		index = 0
		if break_flag == 1:
			break
		for i in range(len(string) - 1):
			if string[index] == 'B' and string[index + 1] == 'G':
				if index == 0:
					output = 'GB'
					if len(string) == 2:
						print(output)
						break_flag = 1
						break
					else:
						string = output + string[2:]
						index += 1
				elif len(string) == 3:
					print(string[0] + 'GB')
					break_flag = 1
					break
				else:
					string = string[0:index] + 'GB' + string[index + 2:]
					index += 1
			index += 1
			if index >= len(string) - 1:
				break
if break_flag == 0:
	print(string)


(n, t) = input().split()
s = input()
n = int(n)
t = int(t)
s = list(s)
for i in range(t):
	check = True
	for j in range(n - 1):
		switch = False
		if check and s[j] == 'B':
			if s[j] != s[j + 1]:
				(s[j], s[j + 1]) = (s[j + 1], s[j])
				switch = True
		if switch:
			check = False
		else:
			check = True
print(''.join(s))


def main():
	n = input().split()
	arrangement = input()
	l = list(arrangement)
	c = 0
	for x in range(int(n[1])):
		while c < len(l) - 1:
			if l[c] == 'B' and l[c + 1] != 'B':
				(l[c], l[c + 1]) = (l[c + 1], l[c])
				c += 2
			else:
				c += 1
		c = 0
	print(''.join(l))
main()


s = input().split()
n = int(s[0])
t = int(s[1])
q = input()

def arr(l, x, y):
	if x == 0:
		return l
	else:
		i = 0
		while i < y - 1:
			if l[i] == 'B' and l[i + 1] == 'G':
				l[i] = 'G'
				l[i + 1] = 'B'
				i += 2
			else:
				i += 1
		return arr(l, x - 1, y)
a = arr(list(q), t, n)
ans = ''
i = 0
while i < n:
	ans += a[i]
	i += 1
print(ans)


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
(n, t) = mi()
i = 0
a = input()
a = list(a)
for j in range(t):
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
print(''.join(a))


(n, k) = map(int, input().split())
s = str(input())
while k != 0:
	s = s.replace('BG', 'GB')
	k = k - 1
print(s)


(total, time) = input().split()
queue = str(input())
queue_list = [i for i in queue]
for i in range(int(time)):
	j = 0
	while j < len(queue_list) - 1:
		if queue_list[j] == 'B' and queue_list[j + 1] == 'G':
			(queue_list[j], queue_list[j + 1]) = ('G', 'B')
			j += 1
		j += 1
queue = ''.join(queue_list)
print(queue)


(n, k) = input().split()

def split(word):
	return [char for char in word]
queue = input()
charQueue = split(queue)
increment = 1
for j in range(int(k)):
	k = 0
	for i in range(0, int(n)):
		if k >= len(charQueue) - 1:
			break
		temp = charQueue[k]
		if charQueue[k] == 'B' and charQueue[k + 1] == 'G':
			charQueue[k] = charQueue[k + 1]
			charQueue[k + 1] = temp
			k += 2
		else:
			k += 1
for i in range(len(charQueue)):
	print(charQueue[i], end='')


(n, t) = [int(x) for x in input().split()]
s = input()
l = list(s)
for i in range(t):
	pos = []
	for j in range(n - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			pos.append([j, j + 1])
	for j in pos:
		(l[j[0]], l[j[1]]) = (l[j[1]], l[j[0]])
s = ''.join(l)
print(s)


(n, k) = map(int, input().split())
s = list(input())
for i in range(k):
	j = 1
	while j < n:
		if s[j] == 'G' and s[j - 1] == 'B':
			temp = s[j]
			s[j] = s[j - 1]
			s[j - 1] = temp
			j += 1
		j += 1
print(''.join(s))


x = input().split()
y = input()
q = []
for i in y:
	q.append(i)
for j in range(int(x[1])):
	for i in range(int(x[0])):
		if i == 0:
			pass
		elif y[i] == 'G' and y[i - 1] == 'B':
			q.pop(i)
			q.insert(i - 1, 'G')
	y = q.copy()
for i in q:
	print(i, end='')


(t, n) = list(map(int, input().split()))
s = str(input())
while n != 0:
	if 'BG' in s:
		s = s.replace('BG', 'GB')
		n -= 1
	else:
		n -= 1
print(s)


def swap(line, pos):
	return line[:pos - 1] + 'GB' + line[pos + 1:]
num = str(input())
num = [int(j) for j in num.split()]
n = num[0]
t = num[1]
line = str(input())
for _ in range(t):
	line = line.replace('BG', 'GB', int(n / 2))
print(line)


(n, t) = list(map(int, input().split()))
str = input()
lst = list(str)
for j in range(t):
	ln = n - 1
	for i in range(n):
		if ln < 1:
			break
		if lst[ln] > lst[ln - 1]:
			lst[ln] = 'B'
			lst[ln - 1] = 'G'
			ln -= 2
		else:
			ln -= 1
str = ''.join(lst)
print(str)


def transform(s):
	output = []
	while len(s) > 0:
		if len(s) > 1 and s[:2] == ['B', 'G']:
			output += ['G', 'B']
			s = s[2:]
		else:
			output.append(s.pop(0))
	return output
(n, t) = [int(x) for x in input().split()]
s = list(input())
for _ in range(t):
	s = transform(s)
print(''.join(s))


(n, t) = map(int, input().split())
s = input()

def queue(s):
	p = []
	for i in s:
		p.append(i)
	for i in range(len(p) - 1):
		if p[i] == 'B' and p[i + 1] == 'G':
			(p[i], p[i + 1]) = ('0', '1')
	s = ''.join(p)
	s = s.replace('0', 'G')
	s = s.replace('1', 'B')
	return s
for i in range(t):
	s = queue(s)
print(s)


a = [int(i) for i in input().split()]
b = input()
n = a[0]
t = a[1]
new = []
for i in range(len(b)):
	new.append(b[i])
c = 0
i = 0
while c < t:
	i = 0
	while i < len(b) - 1:
		if new[i] == 'B' and new[i + 1] == 'G':
			(new[i], new[i + 1]) = (new[i + 1], new[i])
			i += 2
		else:
			i += 1
	c += 1
print(''.join(new))


import queue
n = [int(x) for x in input().split()]
a = list(str(input()))
j = 0
while n[1] > 0:
	i = 0
	while i < len(a) - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 1
		i += 1
	n[1] -= 1
print(''.join(a))


a = input()
(n1, t1) = map(int, a.split())
we = input()
for i in range(t1):
	we = we.replace('BG', 'GB')
print(we)


import sys
a = input()
b = a.split(' ')
n = int(b[0])
t = int(b[1])
m = input()
p = []
q = []
for i in range(n):
	p.append(m[i])
	q.append(m[i])
if n == 1:
	print(m)
else:
	if n == 2 and t == 0:
		print(m)
	if n == 2 and t >= 1:
		if m == 'BG':
			print('GB')
		else:
			print(m)
	if n > 2:
		for i in range(t):
			for j in range(1, n - 1):
				if p[j] == 'B' and p[j + 1] == 'G':
					q[j] = 'G'
					q[j + 1] = 'B'
				elif p[j] == 'G' and p[j - 1] == 'B':
					q[j] = 'B'
					q[j - 1] = 'G'
				else:
					q[j] = p[j]
			for k in range(n):
				p[k] = q[k]
		for i in range(n):
			sys.stdout.write(q[i])


nt = list(map(int, input().split()))
n = nt[0]
t = nt[1]
s = input()
l = []
ans = ''
for x in s:
	if x == 'G':
		l.append(0)
	else:
		l.append(1)
for i in range(t):
	j = n - 1
	while j > 0:
		if l[j] == 0 and l[j - 1] == 1:
			l[j] = 1
			l[j - 1] = 0
			j -= 2
		else:
			j -= 1
for x in l:
	if x == 0:
		ans += 'G'
	else:
		ans += 'B'
print(ans)


(n, t) = [int(x) for x in input().split()]
s = input()
for i in range(t):
	new_s = ''
	for i in range(n):
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			new_s += s[i + 1]
		elif i > 0 and s[i - 1] == 'B' and (s[i] == 'G'):
			new_s += s[i - 1]
		else:
			new_s += s[i]
	s = new_s
print(s)


(s, x) = input().split()
x = int(x)
t = input()
for i in range(0, x):
	t = t.replace('BG', 'GB')
print(t)


mass = []
new_mass = []
(lenght, i) = input().split()
queue = input()
mass.extend(queue)
lenght = int(lenght)
i = int(i)
j = 1
for l in range(i):
	j = 1
	while j < lenght:
		if mass[j] == 'G' and mass[j - 1] == 'B':
			mass[j - 1] = 'G'
			mass[j] = 'B'
			j += 1
		else:
			new_mass.insert(j, mass[j])
		j += 1
string = ''.join(mass)
print(string)


def move(l, n):
	j = 0
	for i in range(n):
		if j >= n - 1:
			break
		elif l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j = j + 2
		else:
			j = j + 1
	return l
(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
l = list(s)
l1 = l
for k in range(t):
	l2 = move(l1, n)
	l1 = l2
s1 = ''
s = s1.join(l1)
print(s)


def main():
	(n, t) = input().split(' ')
	t = int(t)
	s = input()
	arr = list(s)
	i = 0
	while t > 0:
		try:
			while i < len(arr):
				if 'B' == arr[i] and 'G' == arr[i + 1]:
					(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
					i += 2
				else:
					i += 1
		except IndexError:
			pass
		finally:
			i = 0
			t -= 1
	print(''.join(arr))
main()


(number, seconds) = input().split(' ')
(number, seconds) = (int(number), int(seconds))
queue = input()
lis = [char for char in queue]
for second in range(seconds):
	step = 0
	loops = len(lis) - 1
	while step < loops:
		if lis[step] == 'B' and lis[step + 1] == 'G':
			lis[step] = 'G'
			lis[step + 1] = 'B'
			step = step + 2
		else:
			step = step + 1
print(''.join(lis))


(n, k) = map(int, input().split())
l = [x for x in input()]

def modify():
	prevswapper = False
	for i in range(n - 1):
		if prevswapper == True:
			prevswapper = False
			continue
		elif l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			prevswapper = True
for i in range(k):
	modify()
for x in l:
	print(x, end='')
print()


(n, t) = input().split()
s = input()
n = int(n)
t = int(t)
while t:
	x = s.find('BG')
	while x != -1:
		s = s[:x] + 'GB' + s[x + 2:]
		x = s.find('BG', x + 2)
	t = t - 1
print(s)


(n, sec) = map(int, input().split())
queue = list(input())
for i in range(sec):
	j = 0
	while j < len(queue) - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j], queue[j + 1]) = (queue[j + 1], queue[j])
			j += 1
		j += 1
for i in queue:
	print(i, end='')


import sys
(n, t) = sys.stdin.readline().split()
(n, t) = (int(n), int(t))
students = list(sys.stdin.readline())
for _ in range(t):
	i = 0
	while i < n:
		if students[i] == 'B':
			if students[i + 1] == 'G':
				(students[i], students[i + 1]) = (students[i + 1], students[i])
				i += 1
		i += 1
students = ''.join(students)
sys.stdout.write(students + '\n')


(n, t) = (int(i) for i in input().strip().split(' '))
q = [c for c in input().strip()]
if len(q) > 1:
	for i in range(t):
		continue_next = False
		for i in range(len(q) - 1):
			if continue_next:
				continue_next = False
				continue
			if q[i] == 'B' and q[i + 1] == 'G':
				(q[i], q[i + 1]) = (q[i + 1], q[i])
				continue_next = True
print(''.join(q))


import sys

def main():
	inp = sys.stdin.readlines()
	time = inp[0].split(' ')[1]
	queque = [x for x in inp[1]]
	queque.pop()
	pass_next = False
	for t in range(int(time)):
		for (idx, place) in enumerate(queque):
			try:
				if place == 'B' and queque[idx + 1] == 'G' and (not pass_next):
					queque[idx] = 'G'
					queque[idx + 1] = 'B'
					pass_next = True
				else:
					pass_next = False
			except IndexError:
				pass_next = False
	print(''.join(queque))
main()


(n, t) = map(int, input().split())
queue = input()
while t != 0:
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			if i != len(queue) - 2:
				queue = queue[:i] + 'G' + 'B' + queue[i + 2:]
				i += 2
			else:
				queue = queue[:i] + 'G' + 'B'
		else:
			i += 1
	t -= 1
print(queue)


k = input().split()
s = input()
t = int(k[1])
l = []
for j in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
q = list(input())
xr = iter(range(n - 1, 0, -1))
for i in range(t):
	j = n - 1
	while j > 0:
		if q[j] == 'G' and q[j - 1] == 'B':
			(q[j], q[j - 1]) = (q[j - 1], q[j])
			j -= 1
		j -= 1
for i in range(n):
	print(q[i], end='')


(n, t) = map(int, input().split())
s = input()
l = list(s)
swaps = n
count1 = 0
for i in range(t):
	if swaps != 0:
		j = 0
		while j < len(l) - 1:
			if l[j] == 'B':
				if l[j + 1] == 'G':
					l[j] = 'G'
					l[j + 1] = 'B'
					count1 = count1 + 1
					j = j + 2
				else:
					j = j + 1
			else:
				j = j + 1
		swaps = count1
	else:
		break
print(''.join(l))


x = [int(i) for i in input().split()]
queue = input()
for i in range(x[1]):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, t) = list(map(int, input().split()))
p = input()
s = []
for i in p:
	s.append(i)
for j in range(0, t):
	q = []
	for i in range(0, len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G' and (i not in q):
			s[i] = 'G'
			s[i + 1] = 'B'
			q.append(i)
			q.append(i + 1)
p = ''
for i in s:
	p = p + i
print(p)


(p, q) = [int(x) for x in input().split()]
a = input()
for i in range(q):
	a = a.replace('BG', 'GB')
print(a)


(size, flip) = map(int, input().split())
string = input()
for _ in range(flip):
	string = string.replace('BG', 'GB')
print(string)


data = input()
data = data.split()
time = int(data[1])
student = input()
students = []
for i in student:
	students.append(i)
for i in range(time):
	j = 1
	while j <= len(students) - 1:
		if students[j] == 'G' and students[j - 1] == 'B':
			students[j] = 'B'
			students[j - 1] = 'G'
			j += 2
		else:
			j += 1
for i in students:
	print(i, end='')


import math
n = list(map(int, input().split(' ')))
students = n[0]
reverses = n[1]
arr = list(input())
for i in range(reverses):
	j = 0
	while j <= students - 2:
		if arr[j] == 'B' and arr[j + 1] == 'G':
			arr[j + 1] = 'B'
			arr[j] = 'G'
			j += 2
		else:
			j += 1
new_arr = ''
print(new_arr.join(arr))


(n, t) = list(map(int, input().rstrip().split()))
s = list(input())
for j in range(t):
	i = 0
	while i < n:
		if i < n - 1 and s[i + 1] == 'G' and (s[i] == 'B'):
			s[i + 1] = 'B'
			s[i] = 'G'
			i += 1
		i += 1
l = str()
for i in range(n):
	l += s[i]
print(l)


s = input()
seq = input()
new_seq = ''
elem = 0
(num, ops) = list(map(int, s.split()))
seq = list(seq)
while ops > 0:
	elem = 0
	while elem < len(seq):
		if elem < len(seq) - 1:
			if seq[elem] == 'B' and seq[elem + 1] == 'G':
				seq[elem] = 'G'
				seq[elem + 1] = 'B'
				elem += 1
		elem += 1
	ops -= 1
print(''.join(seq))


(n, t) = map(int, input().split())
a = list(map(str, input()))
while t > 0:
	v = 0
	while v < n - 1:
		if a[v] == 'B' and a[v + 1] == 'G':
			temp = a[v]
			a[v] = a[v + 1]
			a[v + 1] = temp
			v += 1
		v += 1
	t -= 1
for i in range(n):
	print(a[i], end='')


(a, b) = map(int, input().split())
i = 0
s = input()
t = [ch for ch in s]
while i < b:
	le = 0
	while le < len(t) - 1:
		if t[le] == 'B' and t[le + 1] == 'G':
			x = t[le]
			t[le] = t[le + 1]
			t[le + 1] = x
			le += 1
		le += 1
	i += 1
ans = ''.join((b for b in t))
print(ans)


(n, t) = map(int, input().split())
l = list(input())
(b, g) = ('B', 'G')
for j in range(t):
	i = n - 1
	while i > 0:
		if i - 1 >= 0:
			if l[i] == 'G' and l[i - 1] == 'B':
				(l[i], l[i - 1]) = (b, g)
				i -= 2
			else:
				i -= 1
print(''.join(l))


(total, time) = input().split()
row = input()
for i in range(int(time)):
	row = row.replace('BG', 'GB')
print(row)


(n, t) = input().split(' ')
s = list(input())
s1 = []
for i in s:
	s1.append(i)
for i in range(int(t)):
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			s1[j] = 'G'
			s1[j + 1] = 'B'
	s = []
	for c in s1:
		s.append(c)
print(''.join(s))


import sys
u = sys.stdin.read().split('\n')
t = int(u[0].split()[1])
s = u[1]
newS = ''
for i in range(t):
	if newS != '':
		s = newS
	newS = ''
	switched = 0
	for j in range(len(s)):
		if s[j] == 'G':
			if switched == 1:
				newS += 'B'
				switched = 0
			else:
				newS += s[j]
		elif j + 1 == len(s):
			newS += s[j]
		elif s[j + 1] == 'G':
			newS += 'G'
			switched = 1
		else:
			newS += s[j]
print(newS)


(n, t) = map(int, input().split())
s = input()
q = []
for i in range(0, len(s)):
	q.append([s[i], 0])
for j in range(0, t):
	for i in range(1, len(s)):
		if q[i - 1][0] == 'B' and q[i][0] == 'G' and (q[i - 1][1] == 0):
			q[i][0] = 'B'
			q[i - 1][0] = 'G'
			q[i][1] = 1
	for i in range(0, n):
		q[i][1] = 0
for i in range(0, n):
	print(q[i][0], end='')


in_string = input().split(' ')
n = int(in_string[0])
t = int(in_string[1])
arr = input()
for i in range(0, t):
	y = 0
	while y < n:
		if y + 1 < n:
			if arr[y] == 'B' and arr[y + 1] == 'G':
				arr = arr[:y] + 'G' + arr[y + 1:]
				arr = arr[:y + 1] + 'B' + arr[y + 2:]
				y += 1
		y += 1
print(arr)


t = [int(i) for i in input().split()]
strg = input()
while t[1] > 0:
	strg = strg.split('BG')
	strg = 'GB'.join(strg)
	t[1] = t[1] - 1
print(strg)


t = int(input().split()[-1])
s = input()
while t:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


yeet = input().split(' ')
t = int(yeet[-1])
queue = list(input())
for second in range(t):
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 1
		i += 1
print(*queue, sep='')


def swapper(n, t, arr):
	for i in range(t):
		i = 0
		while i < n - 1:
			if arr[i] != arr[i + 1] and arr[i] == 'B':
				(arr[i], arr[i + 1]) = (arr[i + 1], arr[i])
				i += 2
			else:
				i += 1
	return ''.join(arr)
(n, t) = map(int, input().split())
string = input()
string_list = list(string)
print(swapper(n, t, string_list))


(n, t) = input().split()
x = input().upper()
n = int(n)
t = int(t)
i = 0
while i < t:
	j = 0
	while j < n - 1:
		nx = ''
		if x[j] == 'B' and x[j + 1] == 'G':
			if j != 0:
				nx += x[0:j]
			nx += x[j + 1:j + 2] + x[j]
			if j != len(x) - 1:
				nx += x[j + 2:len(x)]
			x = nx
			j += 2
		else:
			j += 1
	i += 1
print(x)


(n, t) = map(int, input().split())
line = list((i for i in input()))
for j in range(t):
	m = 0
	while m <= n - 2:
		if line[m] < line[m + 1]:
			(line[m], line[m + 1]) = (line[m + 1], line[m])
			m = m + 2
		else:
			m += 1
out = ''
for j in range(n):
	out = out + line[j] + ''
print(out)


def main():
	(n, t) = map(int, input().split())
	queue = list(input())
	string = ''
	for j in range(0, t):
		i = 1
		while i < n:
			if queue[i] == 'G' and queue[i - 1] == 'B':
				queue[i] = 'B'
				queue[i - 1] = 'G'
				i += 1
			i += 1
	print(string.join(queue))
main()


def gogo(ls, iter):
	j = 0
	while j < iter:
		s = []
		for (i, char) in enumerate(ls):
			if char == 'G':
				if i == 0 or ls[i - 1] == char:
					s += (char,)
				else:
					s.pop()
					s += (char,)
					s += ('B',)
			else:
				s += (char,)
		j += 1
		ls = s
	return ''.join(ls)
(s, iter) = list(map(int, input().split(' ')))
ls = list(input())
print(gogo(ls, iter))


import sys
n = 0
n2 = 0
kidArr = []
results = ''
cont = 0
for l in sys.stdin:
	if n == 0:
		for k in l.split():
			if n2 == 0:
				n2 = n2 + 1
			else:
				time = int(k)
		n = n + 1
		continue
	elif n == 1:
		for k in l:
			kidArr.append(k)
		kidArr.pop()
		break
items = len(kidArr)
while time > 0:
	for (i, k) in enumerate(kidArr):
		if cont == 1:
			cont = 0
			continue
		if i < items - 1:
			if kidArr[i] == 'B':
				if kidArr[i + 1] == 'G':
					kidArr[i] = 'G'
					kidArr[i + 1] = 'B'
					cont = 1
	time = time - 1
for k in kidArr:
	results = results + k
print(results)


a = list(map(int, input().split()))
b = str(input())
c = []
for i in range(len(b) + 1):
	c.append(b[i:i + 1])
	i = 0
for j in range(a[1]):
	i = 0
	while i + 1 <= len(b):
		if c[i] == 'B' and c[i + 1] == 'G':
			c[i] = 'G'
			c[i + 1] = 'B'
			i = i + 1
		i = i + 1
for i in range(len(c)):
	print(c[i], end='')


(_, n) = input().split()
Q = input()
for i in range(int(n)):
	Q = Q.replace('BG', 'GB')
print(Q)


import sys
t = input().split()
o = list(input())
for n in range(int(t[1])):
	g = o.copy()
	for m in range(int(t[0]) - 1):
		if g[m] == 'B' and g[m + 1] == 'G':
			o[m] = 'G'
			o[m + 1] = 'B'
print(''.join(o))


def change(order, n):
	order_new = order.copy()
	for i in range(n - 1):
		if order[i] == 'B' and order[i + 1] == 'G':
			[order_new[i], order_new[i + 1]] = ['G', 'B']
	return order_new
input_string = input()
[n, t] = input_string.split()
input_order = input()
order = list(input_order)
for j in range(int(t)):
	order = change(order, int(n))
print(''.join(order))


inpt = [int(i) for i in input().split()]
str1 = input()
a = 0
arr = []
for s in str1:
	arr.append(s)
for j in range(inpt[1]):
	a = 0
	while a < inpt[0] - 1:
		if arr[a] == 'B' and arr[a + 1] == 'G':
			arr[a] = 'G'
			arr[a + 1] = 'B'
			a = a + 2
		else:
			a = a + 1
for k in arr:
	print(k, end='')


(_, times) = [int(i) for i in input().split()]
queue = input()
for i in range(times):
	queue = queue.replace('BG', 'GB')
print(queue)


a = list(map(int, input().strip().split(' ')))
c = list(input())
for i in range(1, a[1] + 1):
	j = 1
	while j < a[0]:
		if c[j] == 'G' and c[j - 1] == 'B':
			c[j] = 'B'
			c[j - 1] = 'G'
			j += 1
		j += 1
for i in c:
	print(i, end='')
print()


a = input().split()
time = int(a[1])
b = list(input())
while time != 0:
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i += 2
		else:
			i += 1
	time -= 1
print(''.join(b))


a = list(map(int, input().split()))
z = input()
while a[1]:
	z = z.replace('BG', 'GB')
	a[1] -= 1
print(z)


(n, t) = map(int, input().split())
x = input('')
y = len(x)
z = []
for c in range(n):
	z.append(x[c])
if t > 1:
	for count in range(t):
		pos = 0
		while pos < y - 1:
			if x[pos] == 'B' and x[pos + 1] == 'G':
				z[pos] = 'G'
				z[pos + 1] = 'B'
			pos += 1
		x = ''.join(map(str, z))
if t == 1:
	pos = 0
	while pos < y - 1:
		if x[pos] == 'B' and x[pos + 1] == 'G':
			z[pos] = 'G'
			z[pos + 1] = 'B'
		pos += 1
x = ''
x = x.join(map(str, z))
print(x)


(number_of_children, time) = map(int, input().split(' '))
school_children_order = list(input())
for each_second in range(0, time):
	index = 0
	while index < number_of_children:
		if school_children_order[index] == 'B' and index + 1 != number_of_children:
			if school_children_order[index + 1] == 'G':
				temp = school_children_order[index]
				school_children_order[index] = school_children_order[index + 1]
				school_children_order[index + 1] = temp
				index += 2
			else:
				index += 1
		else:
			index += 1
print(''.join(school_children_order))


(n, t) = map(int, input().split())
arr = []
q = input()
for i in q:
	arr.append(i)
boys = []
girls = []
for i in range(len(arr)):
	if arr[i] == 'B':
		boys.append(i)
	else:
		girls.append(i)
for i in range(t):
	for j in range(len(boys)):
		if boys[j] + 1 in girls:
			ind = girls.index(boys[j] + 1)
			girls[ind] = girls[ind] - 1
			boys[j] = boys[j] + 1
ans = [0] * n
for i in boys:
	ans[i] = 'B'
for i in girls:
	ans[i] = 'G'
fans = ''
for i in ans:
	fans += i
print(fans)


(n, t) = input().split()
pat = list(input())
for i in range(0, int(t)):
	i = 0
	while i < int(n) - 1:
		if pat[i] == 'B' and pat[i + 1] == 'G':
			pat[i] = 'G'
			pat[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(pat))


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	i = 1
	while i < len(s):
		if s[i] == 'G' and s[i - 1] == 'B':
			tmp = s[i]
			s[i] = s[i - 1]
			s[i - 1] = tmp
			i += 1
		i += 1
print(''.join(s))


(length, time) = map(int, input().split())
queue = list(input())
for _ in range(time):
	index_list = []
	for i in range(length - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			index_list.append(i)
	for i in range(len(index_list)):
		(queue[index_list[i]], queue[index_list[i] + 1]) = (queue[index_list[i] + 1], queue[index_list[i]])
print(''.join(queue))


import re
time = list(map(int, input().split()))[1]
queue = input()
qlist = list(queue)
for t in range(0, time):
	for m in re.finditer('BG', queue):
		(qlist[m.start() + 1], qlist[m.start()]) = (qlist[m.start()], qlist[m.start() + 1])
		queue = ''.join(qlist)
print(queue)


(n, t) = map(int, input().split())
q = list(input())
new_q = q.copy()
for i in range(t):
	for j in range(n - 1):
		if q[j] == 'B' and q[j + 1] == 'G':
			new_q[j] = 'G'
			new_q[j + 1] = 'B'
	q = new_q.copy()
import re
output_q = re.sub("[\\[\\],'' ]", '', str(q))
print(output_q)


(n, t) = input().split()
(n, t) = (int(n), int(t))
s = input()
l = []
for i in range(n):
	l.append(s[i])
for k in range(t):
	x = []
	for j in range(n - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			x.append(j)
	for y in x:
		l[y] = 'G'
		l[y + 1] = 'B'
print(''.join(l))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
(number_of_children, time) = get_ints()
mot = input()
for t in range(time):
	x = 1
	while x < len(mot):
		if mot[x - 1] == 'B' and mot[x] == 'G':
			mot = mot[:x - 1] + 'GB' + mot[x + 1:]
			x += 1
		x += 1
print(mot)


def convert(s):
	str1 = ''
	return str1.join(s)
first_line = input().split()
n = int(first_line[0])
t = int(first_line[1])
second_line = input()
second_line = list(second_line)
for i in range(t):
	p = 1
	for j in range(1, n):
		if p < n:
			if second_line[p] == 'G':
				if second_line[p - 1] == 'B':
					(second_line[p - 1], second_line[p]) = (second_line[p], second_line[p - 1])
					p = p + 1
		p = p + 1
print(convert(second_line))


L = input()
L = L.split()
n = int(L[0])
t = int(L[1])
C = input()
Cola = []
for i in range(n):
	Cola.append(C[i])
for i in range(t):
	Aux = 0
	while Aux < n - 1:
		if Cola[Aux] == 'B' and Cola[Aux + 1] == 'G':
			Cola[Aux + 1] = 'B'
			Cola[Aux] = 'G'
			Aux += 2
		else:
			Aux += 1
R = ''
for k in range(n):
	R += Cola[k]
print(R)


(n, t) = map(int, input().split())
s = input()
L = list(s)

def swap(a, b):
	return (b, a)
for i in range(t):
	j = n - 1
	while j > 0:
		if L[j] == 'G' and L[j - 1] == 'B':
			(L[j], L[j - 1]) = swap(L[j], L[j - 1])
			j -= 1
		j -= 1
s = ''.join(L)
print(s)


(N, T) = map(int, input().split())
L = list(input())
for j in range(T):
	nL = []
	for i in range(len(L)):
		if L[i] == 'B':
			nL.append(L[i])
		elif L[i] == 'G':
			if i != 0:
				if L[i - 1] == 'B':
					nL[i - 1] = 'G'
					nL.append('B')
				else:
					nL.append('G')
			else:
				nL.append('G')
	L = nL
L = ''.join(L)
print(L)


(n, t) = input().split(' ')
n = int(n)
t = int(t)

def queue(list1):
	new_string = ''
	i = 0
	while i < len(list1):
		if i != len(list1) - 1:
			if list1[i] == 'B' and list1[i + 1] == 'G':
				new_string += 'G'
				new_string += 'B'
				i = i + 2
			else:
				new_string += list1[i]
				i = i + 1
		else:
			new_string += list1[i]
			i = i + 1
	return new_string
string = input()
for iter in range(t):
	string = queue(string)
print(string)


entrada = input().split()
n = int(entrada[0])
t = int(entrada[1])
fila = list(input())
for j in range(t):
	i = 0
	while i < n:
		if fila[i] == 'B':
			if i + 1 < n and fila[i + 1] == 'G':
				(fila[i], fila[i + 1]) = (fila[i + 1], fila[i])
				i += 2
			else:
				i += 1
		else:
			i += 1
print(''.join(fila))


numbers = input()
time = int(numbers.split(' ')[1])
line = input()
for x in range(time):
	line = line.replace('BG', 'GB')
print(line)


list = input().split(' ')
line = input()
n = int(list[0])
second = int(list[1])
while second > 0:
	line = line.replace('BG', 'GB')
	second -= 1
print(line)


(n, t) = map(int, input().split())
s = list(input())
index = []
for i in range(n):
	if s[i] == 'B':
		index.append(i)
while t:
	for j in range(len(index)):
		try:
			if s[index[j] + 1] == 'G':
				temp = s[index[j] + 1]
				s[index[j] + 1] = s[index[j]]
				s[index[j]] = temp
				index[j] += 1
		except IndexError:
			pass
	t -= 1
k = ''
print(k.join(s))


(n, t) = map(int, input().split())
a = list(input())
for i in range(t):
	iter = True
	for p in range(0, len(a) - 1):
		if a[p] == 'B' and a[p + 1] == 'G' and iter:
			(a[p], a[p + 1]) = (a[p + 1], a[p])
			iter = False
		else:
			iter = True
print(''.join(a))


(n, t) = [int(i) for i in input().split()]
s = input()
sl = [c for c in s]
for _ in range(t):
	i = 0
	while i < len(s) - 1:
		if sl[i] + sl[i + 1] == 'BG':
			(sl[i], sl[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
print(''.join(sl))


(a, b) = map(int, input().split())
X = list(input())
L = X.copy()
count = 0
while count < b:
	for i in range(a - 1):
		if X[i] == 'B' and X[i + 1] == 'G':
			(L[i], L[i + 1]) = ('G', 'B')
	count += 1
	X = L.copy()
print(''.join(L))


def soletrar(palavra):
	letras = []
	for a in range(len(palavra)):
		letras.append(palavra[a])
	return letras
(n, t) = input().split(' ')
(n, t) = (int(n), int(t))
nf = []
b = input()
f = soletrar(b)
l = f
m = ''
if n == 1:
	m = m.join(f)
	print(m)
else:
	for h in range(0, t):
		z = 0
		while z < len(l):
			z = int(z)
			if l[z] == 'B':
				if z == len(l) - 1:
					nf.append('B')
				elif l[z + 1] == 'G':
					nf.append('G')
					nf.append('B')
					z += 1
				else:
					nf.append('B')
			else:
				nf.append('G')
			z += 1
		l = nf
		nf = []
	m = m.join(l)
	print(m)


from sys import stdin
(n, t) = map(int, stdin.readline().split())
string = stdin.readline()
i = 0
array = [i for i in string]
for time in range(t):
	i = 0
	while i < n - 1:
		if array[i] == 'B' and array[i + 1] == 'G':
			array[i] = 'G'
			array[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(array))


(_, t) = map(int, input().split(' '))
q = input()
while t > 0:
	q = q.replace('BG', 'GB')
	t -= 1
print(q)


(p, t) = input().split()
p = int(p)
t = int(t)
pes = list(input())
for i in range(t):
	x = 0
	while x < p - 1:
		if pes[x] == 'G':
			x += 1
		if x != p - 1:
			if pes[x] == 'B' and pes[x + 1] == 'G':
				pes[x + 1] = 'B'
				pes[x] = 'G'
				x += 2
			else:
				x += 1
for i in range(len(pes)):
	print(pes[i], end='')


def convert(s):
	new = ''
	for x in s:
		new += x
	return new
(x, y) = map(int, input().split())
t = input()
t = list(t)
for i in range(0, y):
	j = 0
	while j < len(t) - 1:
		if t[j] == 'B' and t[j + 1] == 'G':
			t[j] = 'G'
			t[j + 1] = 'B'
			j = j + 1
		j = j + 1
print(convert(t))


from sys import stdin as si
from collections import Counter as c

class Solution:

	def bazinga(self, n, m, s):
		for i in range(m):
			s = s.replace('BG', 'GB')
		return s
(n, m) = map(int, si.readline().strip().split())
s = si.readline().strip()
S = Solution()
print(S.bazinga(n, m, s))


a = [int(x) for x in input().split()]
n = a[0]
t = a[1]
s = input()
s = [i for i in s]
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] < s[j + 1]:
			temp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = temp
			j += 1
		j += 1
print(''.join(s))


import math
(m, n) = map(int, input().split())
l = str(input(''))
s = list(l)
for x in range(0, n):
	j = 0
	while j < m - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			k = s[j + 1]
			s[j + 1] = 'B'
			s[j] = k
			j = j + 2
		else:
			j = j + 1
print(''.join(s))


NT = input().split()
n = int(NT[0])
t = int(NT[1])
queue = input()
for i in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


(n, t) = map(int, input().split())
q = [x for x in input()]
for _ in range(t):
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			i += 1
		i += 1
print(*q, sep='')


def switch(s1):
	s = s1[:]
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = ('G', 'B')
			i += 1
		i += 1
	return s
(n, t) = map(int, input().split())
li = list(input())
for _ in range(t):
	li = switch(li)
print(''.join(li))


inStr = input()
n = int(inStr.split(' ')[0])
t = int(inStr.split(' ')[1])
inStr = input()
ans = inStr
for i in range(t):
	ans = ans.replace('BG', 'GB')
print(ans)


(n, t) = map(int, input().split())
q = input()
s = list(q)
tlst = s.copy()
for i in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			tmp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = tmp
			j += 2
		else:
			j += 1
g = ''
g = g.join(s)
print(g)


line = input()
line = line.split()
n = int(line[0])
t = int(line[1])
line = input()
line = line.upper()
line = list(line)
while t > 0:
	t = t - 1
	i = 0
	while i < n - 1:
		if line[i] == 'B':
			if line[i + 1] == 'G':
				line[i] = 'G'
				line[i + 1] = 'B'
				i = i + 2
				continue
		i = i + 1
nline = ''
for i in range(0, n):
	nline = nline + line[i]
print(nline)


import copy as cp
[n, t] = list(map(int, input().split()))
cad = input()
bp = []
for i in range(len(cad)):
	if cad[i] == 'B':
		bp.append(i)
bp.reverse()
nl = cp.copy(bp)
for i in range(t):
	for j in range(len(bp)):
		if j == 0:
			if bp[j] < n - 1:
				nl[j] = bp[j] + 1
		elif bp[j] != bp[j - 1] - 1:
			nl[j] = bp[j] + 1
		else:
			nl[j] = bp[j]
	bp = cp.copy(nl)
bp.reverse()
bp.append(10000)
it = 0
pos = 0
while it < n:
	if it != bp[pos]:
		print('G', end='')
	else:
		print('B', end='')
		pos += 1
	it += 1
print()


(n, t) = input().split()
n = int(n)
t = int(t)
l = input()
l = list(l)
j = 0
for i in range(0, t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			temp = l[j]
			l[j] = l[j + 1]
			l[j + 1] = temp
			j = j + 2
		else:
			j = j + 1
ans = ''
for i in l:
	ans += i
print(ans)


(n, t) = map(int, input().split(' '))
a = list(input())
for T in range(0, t):
	i = 0
	while i < n - 1:
		if ord(a[i]) < ord(a[i + 1]):
			x = a[i]
			a[i] = a[i + 1]
			a[i + 1] = x
			i += 2
		else:
			i += 1
for j in range(0, n):
	print(a[j], end='')


n = int(input()[2:])
ans = input()
while n:
	ans = ans.replace('BG', 'GB')
	n -= 1
print(ans)


(n, t) = [int(x) for x in input().split()]
queue = list(input())
for i in range(t):
	flipped = 0
	for j in range(n - 1, 0, -1):
		c = j - flipped
		if c < 1:
			break
		if queue[c - 1] == 'B' and queue[c] == 'G':
			(queue[c], queue[c - 1]) = (queue[c - 1], queue[c])
			flipped += 1
print(''.join(queue))


import sys
numbers = [int(i) for i in sys.stdin.readline().split()]
n = numbers[0]
t = numbers[1]
s = list(sys.stdin.readline())[:-1]
j = 1
while j <= t:
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
	j += 1
print(''.join(s))


(n, m) = [int(i) for i in input().split()]
ar = input()
lst = list(ar)
lt = []
t = True
for i in range(m):
	(a, b, c, f) = (0, 0, 0, 0)
	l = len(lst)
	while l > 1:
		if lst[a] == 'B' and lst[a + 1] == 'G':
			t = lst[a]
			lst[a] = lst[a + 1]
			lst[a + 1] = t
			a = a + 1
			l = l - 1
		a = a + 1
		l = l - 1
mylist = ''.join(map(str, lst))
print(mylist)


(n, t) = map(int, input().split())
l = input()
l = list(l)
l1 = list(l)
for i in range(t):
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			(l1[i], l1[i + 1]) = (l1[i + 1], l1[i])
	l = list(l1)
for i in range(n):
	print(l[i], end='')


input_s = input().split(' ')
input_l = input()
t = int(input_s[1])
i = 0
while i < t:
	i += 1
	j = 0
	input_l_2 = ''
	while j < len(input_l):
		if j == len(input_l) - 1:
			input_l_2 += input_l[j]
			j += 1
		elif input_l[j] == 'G':
			input_l_2 += 'G'
			j += 1
		elif input_l[j + 1] == 'G':
			input_l_2 += 'GB'
			j += 2
		else:
			input_l_2 += 'B'
			j += 1
	input_l = input_l_2
print(input_l)


(n, t) = map(int, input().split())
string = input()
queue = []
for letter in string:
	queue.append(letter)
sec = 0
while sec < t:
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
	sec += 1
print(''.join((str(i) for i in queue)))


(n, t) = [int(x) for x in input().split()]
q = list(input())
for i in range(t):
	k = False
	for j in range(len(q) - 1):
		if k == True:
			k = False
			continue
		if q[j] == 'B' and q[j + 1] == 'G':
			(q[j], q[j + 1]) = (q[j + 1], q[j])
			k = True
print(''.join(q))


nt = list(map(int, input().strip().split()))
n = nt[0]
t = nt[1]
s = list(input().strip())
time = 0
while time < t:
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
	time += 1
print(''.join(s))


masukan1 = input()
masukan2 = input()
masukanl = []
for i in masukan1.split():
	masukanl = masukanl + [int(i)]
n = masukanl[0]
t = masukanl[1]
masukanl2 = []
for i in masukan2:
	masukanl2 = masukanl2 + [i]
for a in range(0, t):
	masukanl3 = []
	x = 0
	for i in range(0, len(masukanl2) - 1):
		if x == 1:
			masukanl3 = masukanl3 + ['B']
			x = 0
		elif masukanl2[i] == 'B' and masukanl2[i + 1] == 'G':
			masukanl3 = masukanl3 + ['G']
			x = 1
		else:
			masukanl3 = masukanl3 + [masukanl2[i]]
	if x == 1:
		masukanl3 = masukanl3 + ['B']
	else:
		masukanl3 = masukanl3 + [masukanl2[len(masukanl2) - 1]]
	masukanl2 = []
	masukanl2 = masukanl3
output = ''
if len(masukan2) > 1:
	for i in masukanl3:
		output = output + i
else:
	output = masukan2[0]
print(output)


(nennum, num) = map(int, input().split())
st = input()
for x in range(num):
	st = st.replace('BG', 'GB')
print(st)


(n, m) = map(int, input().split(' '))
T = input('')
for k in range(m):
	k = 0
	strq = ''
	while k < n - 1:
		if T[k] == 'B' and T[k + 1] == 'G':
			strq += 'GB'
			k += 2
		else:
			strq += T[k]
			k += 1
	if k == n - 1:
		strq += T[n - 1]
	T = strq
print(strq)


(n, a) = [int(i) for i in input().split()]
ln = str(input())
for j in range(a):
	ln = ln.replace('BG', 'GB')
print(''.join(ln))


temp = [int(i) for i in input().split()]
n = temp[0]
t = temp[1]
st = list(input())
for j in range(t):
	i = 0
	while i <= n - 2:
		if st[i] == 'B' and st[i + 1] == 'G':
			st[i + 1] = 'B'
			st[i] = 'G'
			i = i + 2
		else:
			i += 1
for i in st:
	print(i, end='')


(n, t) = tuple(map(int, input().split()))
s = input()
l = list(s)
for k in range(t):
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			z = l[i]
			l[i] = l[i + 1]
			l[i + 1] = z
			i += 2
		else:
			i += 1
k = ''.join(l)
print(k)


a = input().split(' ')
a = [int(i) for i in a]
c = a[1]
b = input()
b = [i for i in b]
for item in range(c):
	p1 = False
	for i in range(len(b) - 1):
		if p1:
			p1 = False
			continue
		if b[i] == 'B' and b[i + 1] == 'G':
			b[i] = 'G'
			b[i + 1] = 'B'
			p1 = True
wynik = ''
for i in b:
	wynik = wynik + i
print(wynik)


queue = input().split(' ')
order = input()
time = int(queue[1])
queue1 = [char for char in order]

def movequeue(order):
	sa = 0
	while sa < len(order) - 1:
		if sa < len(order):
			if order[sa] == 'B' and order[sa + 1] == 'G':
				(order[sa], order[sa + 1]) = (order[sa + 1], order[sa])
				sa += 2
			else:
				sa += 1
	return order
for t in range(time):
	queue1 = movequeue(queue1)
string = ''
for element in queue1:
	string += str(element)
print(string)


(x, y) = (int(x) for x in input().split())
queue = []
queue = list(input())
for i in range(y):
	j = 0
	while j < x - 1:
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j + 1], queue[j]) = (queue[j], queue[j + 1])
			j += 2
		else:
			j += 1
for i in range(x):
	print(queue[i], end='')


row = str(input()).split(' ')
n = int(row[0])
t = int(row[1])
line = list(str(input()))
for i in range(0, t):
	u = 0
	while u < n - 1:
		if line[u] == 'B' and line[u + 1] == 'G':
			line[u] = 'G'
			line[u + 1] = 'B'
			u += 2
		else:
			u += 1
print(''.join(line))


import sys

def solve():
	(n, t) = map(int, input().split())
	q = [ch for ch in input()]
	for i in range(t):
		ps = -1
		for i in range(n - 1):
			if i == ps:
				continue
			if q[i] == 'B' and q[i + 1] == 'G':
				(q[i], q[i + 1]) = (q[i + 1], q[i])
				ps = i + 1
	print(''.join(q))
solve()


(n, t) = map(int, input().split())
ss = input()
ss = [ss[i] for i in range(n)]
ttt = 0
while ttt < t:
	i = 0
	while i < n - 1:
		if ss[i] == 'B' and ss[i + 1] == 'G':
			ss[i] = 'G'
			ss[i + 1] = 'B'
			i += 2
		else:
			i += 1
	ttt += 1
ss = ''.join(ss)
print(ss)


def lineup(t, queue):
	counter = []
	for _ in range(t):
		for i in range(len(queue)):
			try:
				if queue[i] == 'B' and queue[i + 1] == 'G':
					counter.append(i)
			except:
				pass
		for x in counter:
			queue[x] = 'G'
			queue[x + 1] = 'B'
	return queue
nt = list(map(int, input().split()))
(n, t) = (nt[0], nt[1])
queue = list(''.join(input().split()))
for x in lineup(t, queue):
	print(x, end='')


s = str(input())
e = s.split(' ')
ss = str(input())
for h in range(int(e[1])):
	i = 0
	while i < int(e[0]) - 1:
		if ss[i:i + 1] == 'B' and ss[i + 1:i + 2] == 'G':
			ss = ss[0:i] + ss[i + 1:i + 2] + ss[i:i + 1] + ss[i + 2:len(ss)]
			i += 1
		i += 1
print(ss)


(q, n) = [int(x) for x in input().split()]
queue = list(input())
for j in range(n):
	i = 0
	while i < q - 1:
		if queue[i] < queue[i + 1]:
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
result = ''.join(queue)
print(result)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
line = list(input())
for j in range(0, t):
	i = 0
	while i < n - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			line[i] = 'G'
			line[i + 1] = 'B'
			i = i + 1
		i = i + 1
print(''.join(line))


(c, d) = input().split()
c = int(c)
d = int(d)
a = input()
x = list()
y = list()
for i in range(0, len(a)):
	x.append(a[i])
	y.append(a[i])
while d:
	i = 0
	while i != c - 1:
		if x[i] == 'B' and x[i + 1] == 'G':
			m = y[i]
			y[i] = y[i + 1]
			y[i + 1] = m
		else:
			pass
		i += 1
	for j in range(0, c):
		x[j] = y[j]
	d -= 1
print(''.join(y))


n = input().split(' ')
s = input()

def split(s):
	return list(s)
s = split(s)
c = 0
k = 0
for i in range(0, int(n[1])):
	k = 0
	try:
		for j in range(0, int(n[0]) - 1):
			j = j + k
			if s[j] == 'B' and s[j + 1] == 'G':
				s[j] = 'G'
				s[j + 1] = 'B'
				k += 1
			else:
				pass
	except:
		pass
print(*s, sep='')


import sys
a = list(map(int, input().split()))
b = list(input())
c = 0
p = 0
k = a[1]
ch = []
for i in range(0, a[0] - 1):
	if b[i] == 'B' and b[i + 1] == 'G':
		c = c + 1
		ch.append(i)
	else:
		pass
while a[1] > 0:
	a[1] = a[1] - 1
	for k in range(0, len(ch)):
		temp = b[ch[k]]
		b[ch[k]] = b[ch[k] + 1]
		b[ch[k] + 1] = temp
		p = p + 1
	if c == p:
		del ch[0:len(ch)]
		c = 0
		p = 0
		for i in range(0, a[0] - 1):
			if b[i] == 'B' and b[i + 1] == 'G':
				c = c + 1
				ch.append(i)
f = ''.join(b)
print(f)
sys.exit


(n, t) = [int(i) for i in input().split()]
string = input()
for i in range(t):
	s = string.find('BG', 0)
	while s != -1:
		string = string[:s] + 'GB' + string[s + 2:]
		s = string.find('BG', s + 2)
print(string)


(num, t) = [int(elem) for elem in input().split()]
ln = input()
for i in range(t):
	ln = ln.replace('BG', 'GB')
print(ln)


(length, time) = map(int, input().split())
queue = list(input())
next = ''
for y in range(time):
	for x in range(length - 1, 0, -1):
		if queue[x] == 'G' and queue[x - 1] == 'B' and (next != queue[x - 1]):
			next = 'B'
			queue[x] = 'B'
			queue[x - 1] = 'G'
		else:
			next = ''
next = ''
for item in queue:
	next += item
print(next)


(n, t) = map(int, input().split())
string = input()
for time in range(t):
	str = string.replace('BG', 'GB')
	string = str
print(string)


(n, t) = map(int, input().split())
seq = input().rstrip().lstrip()
main = [i for i in seq]

def find_boys(s):
	d = []
	for i in range(len(s)):
		if s[i] == 'B':
			d.append(i)
	return d
for i in range(t):
	li = find_boys(main)
	for j in li:
		if j != len(main) - 1 and main[j + 1] == 'G':
			(main[j], main[j + 1]) = (main[j + 1], main[j])
print(''.join(main))


(n, k) = list(map(int, input().split()))
l = input()
s = list(l)
for i in range(k):
	y = []
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			y.append(j)
	for m in y:
		if m < n:
			s[m] = 'G'
			s[m + 1] = 'B'
print(''.join(s))


(n, t) = map(int, input().split())
s = [c for c in input()]
for i in range(t):
	skip = False
	for (j, n) in enumerate(s[:-1]):
		if skip == True:
			skip = False
			continue
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = ('G', 'B')
			skip = True
print(''.join((c for c in s)))


inp1 = input()
inp1 = inp1.split()
inp2 = input()
inp2 = [char for char in inp2]
for _ in range(int(inp1[1])):
	i = 0
	while i <= int(inp1[0]) - 2:
		if inp2[i] == 'B' and inp2[i + 1] == 'G':
			inp2[i + 1] = 'B'
			inp2[i] = 'G'
			i = i + 2
		else:
			i = i + 1
print(''.join(inp2))


def szkola(slowo, n):
	wynik = list(slowo)
	for x in range(n):
		i = 0
		while i < len(wynik) - 1:
			if wynik[i] == 'B' and wynik[i + 1] == 'G':
				wynik[i] = 'G'
				wynik[i + 1] = 'B'
				i += 1
			i += 1
	wynik_slowo = ''
	for i in wynik:
		wynik_slowo += i
	return wynik_slowo
(a, n) = map(int, input().split())
slowo = input()
print(szkola(slowo, n))


(x, y) = input().split()
x = int(x)
y = int(y)
str1 = input()
str1 = list(str1)
str2 = []
count = 0
flag = 0
for i in range(0, y):
	for j in range(0, x):
		if j + 1 < x and flag == 0:
			if str1[j] == 'B' and str1[j + 1] == 'G':
				temp = str1[j]
				str1[j] = str1[j + 1]
				str1[j + 1] = temp
				flag = 1
		else:
			flag = 0
strx = ''
print(strx.join(str1))


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
T = list(s)
k = 0
for k in range(t):
	i = 0
	while i < n - 1:
		if T[i] == 'B' and T[i + 1] == 'G':
			(T[i], T[i + 1]) = (T[i + 1], T[i])
			i += 1
		i += 1
a = ''
for j in range(n):
	a = a + T[j]
print(a)


(x, t) = (int(x) for x in input().split())
l = input()
for i in range(t):
	l = l.replace('BG', 'GB')
print(l)


(tot, sec) = input().split()
tot = int(tot)
sec = int(sec)
q = input()
for i in range(0, sec):
	q = q.replace('BG', 'GB')
print(q)


(n, t) = map(int, input().split())
s = str(input())
a = s
for i in range(t):
	a = s
	for x in range(n - 1):
		if a == s and s[x] == 'B' and (s[x + 1] == 'G'):
			s = s[:x] + 'GB' + s[x + 2:]
		else:
			a = s
print(s)


a = list(map(int, input().split()))
l = list(input())
for i in range(a[1]):
	j = 0
	while j < a[0] - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 2
			continue
		j += 1
print(''.join(l))


import re
line = input().split(' ')
(n, s) = (line[0], int(line[1]))
positions = input()
for i in range(s):
	positions = positions.replace('BG', 'GB')
print(positions)


line1 = input().split()
n = int(line1[0])
t = int(line1[1])
line2 = input()
L1 = ['0']
for i in range(n):
	L1.append(line2[i])
L1.append('0')
L2 = ['0']
if n == 1:
	print(line2)
else:
	while t > 0:
		for i in range(1, n + 1):
			if L1[i] == 'B':
				if L1[i + 1] == 'G':
					L2.append('G')
				else:
					L2.append('B')
			elif L1[i - 1] == 'B':
				L2.append('B')
			else:
				L2.append('G')
		L2.append('0')
		L1 = L2
		L2 = ['0']
		t -= 1
	for j in range(1, n + 1):
		print('%s' % L1[j], end='')


(n, t) = [int(i) for i in input().split()]
l = list(input())
for p in range(t):
	m = []
	for j in range(1, n):
		if l[j - 1] == 'B' and l[j] == 'G':
			m.append(j)
	for k in range(len(m)):
		l[m[k] - 1] = 'G'
		l[m[k]] = 'B'
print(''.join(l))


(n, t) = input().split()
st = input()
for w in range(int(t)):
	st = [i for i in st]
	for i in range(int(n) - 1):
		if st[i] == 'B' and st[i + 1] == 'G':
			st[i] = 'G'
			st[i + 1] = 'K'
	st = ''.join(st)
	st = str(st.replace('K', 'B'))
print(st)


def fun(s, n):
	temp = ''
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			temp += 'GB'
			i += 2
			if i == n - 1:
				temp += s[i]
		elif i == n - 2:
			temp += s[i:]
			i += 1
		else:
			temp += s[i]
			i += 1
	return temp
(n, t) = map(int, input().split())
s = input()
for i in range(t):
	if n > 1:
		s = fun(s, n)
print(s)


x = int(input().split()[1])
y = [ch for ch in input()]
ace = ''
for i in range(x):
	for g in range(len(y) - 1):
		if y[g] == 'B' and y[g + 1] == 'G':
			swapper = y[g]
			y[g] = y[g + 1]
			y[g + 1] = 'b'
	for z in range(len(y)):
		if y[z] == 'b':
			y[z] = 'B'
for c in y:
	ace += c
print(ace)


(n, t) = map(int, input().split())
x = str(input())
y = []
for i in range(t):
	for i in range(n - 1):
		if x[i] == 'B' and x[i + 1] == 'G':
			y = y + [i]
	for i in y:
		x = x[:i] + 'G' + 'B' + x[i + 2:]
print(x)


def get_status(length: int, time: int, queue_string: str) -> str:
	queue_list = list(queue_string)
	for _ in range(time):
		index = queue_string.find('BG')
		while index >= 0:
			queue_list[index] = 'G'
			queue_list[index + 1] = 'B'
			index = queue_string.find('BG', index + 2)
		queue_string = ''.join(queue_list)
	return queue_string
(n, t) = map(int, input().split())
s = input()
print(get_status(n, t, s))


(n, t) = list(map(int, input().split()))
questr = str(input())
que = []
for ch in questr:
	que.append(ch)
for j in range(t):
	i = 1
	while i < n:
		if que[i] == 'G' and que[i - 1] == 'B':
			que[i] = 'B'
			que[i - 1] = 'G'
			i += 1
		i += 1
str1 = ''.join(map(str, que))
print(str1)


(n, time) = map(int, input().split(' '))
students = list(input())
currentPos = 0
for t in range(time):
	while currentPos < len(students) - 1:
		if students[currentPos] == 'B' and students[currentPos + 1] == 'G':
			students[currentPos] = 'G'
			students[currentPos + 1] = 'B'
			currentPos += 2
		else:
			currentPos += 1
	currentPos = 0
print(''.join(students))


n = [int(x) for x in input().split()]
row = input()
bulklist = []
a = []
for j in range(len(row)):
	bulklist.append(row[j])
for i in range(n[-1]):
	for ren in range(len(bulklist) - 1):
		if bulklist[ren] == 'B':
			a.append(ren)
	for k in a:
		bulklist[k] = bulklist[k + 1]
		bulklist[k + 1] = 'B'
	a = []
print(''.join(bulklist))


(n, t) = list(map(int, input().split(' ')))
x = list(input().strip())
for j in range(t):
	swap_list = []
	for i in range(1, len(x)):
		if x[i] == 'G' and x[i - 1] == 'B':
			swap_list.append(i)
	for item in swap_list:
		(x[item], x[item - 1]) = (x[item - 1], x[item])
result = ''
for elem in x:
	result += elem
print(result)


def f(t, s):
	(s, n) = (list(s), len(s))
	for _ in range(t):
		i = 1
		while i < n:
			if s[i - 1] == 'B' and s[i] == 'G':
				(s[i - 1], s[i]) = (s[i], s[i - 1])
				i += 2
			else:
				i += 1
	return ''.join(s)
assert f(1, 'BGGBG') == 'GBGGB'
assert f(2, 'BGGBG') == 'GGBGB'
assert f(1, 'GGGB') == 'GGGB'
(n, t) = map(int, input().split())
s = input()
ans = f(t, s)
print(ans)


import math
(n, t) = map(int, input().split())
data = []
data = list(input())
position = [0 for i in range(len(data))]
for i in range(t):
	position = [0 for i in range(len(data))]
	for pos in range(len(data) - 1, 0, -1):
		if data[pos] == 'G' and data[pos - 1] == 'B':
			position[pos - 1] = pos
	for pos in range(len(data)):
		if position[pos] != 0:
			(data[pos], data[position[pos]]) = (data[position[pos]], data[pos])
print(''.join(data))


(n, t) = map(int, input().split())
s = list(input())
M = 0
for i in range(t):
	M = 0
	for o in range(n - 1):
		if not M:
			if s[o] == 'B' and s[o + 1] == 'G':
				s[o] = 'G'
				s[o + 1] = 'B'
				M = 1
		else:
			M = 0
s1 = ''.join(s)
print(s1)


(n, t) = map(int, input().split())
s = input()
a = []
for i in s:
	a.append(i)
k = 0
while k < t:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i += 2
		else:
			i += 1
	k += 1
z = ''.join(a)
print(z)


(n, t) = [int(x) for x in input().split()]
a = str(input())
a = list(a)
p = ''
for q in range(t):
	i = -1
	while i < n - 1:
		i += 1
		if i == len(a) - 1:
			break
		elif a[i] == 'B' and a[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
			i += 1
for k in a:
	p += str(k)
print(p)


(n, sec) = map(int, input().split())
queue = list(input())
for i in range(sec):
	index = 0
	while index < len(queue) - 1:
		if queue[index] == 'B' and queue[index + 1] == 'G':
			queue[index] = 'G'
			queue[index + 1] = 'B'
			index += 2
		else:
			index += 1
print(''.join(queue))


(n_value, t_value) = list(map(int, input().split()))
initial_queue = list(input())
pos = 0
queue_t = list(initial_queue)
for dummy in range(t_value):
	while pos < n_value - 1:
		if queue_t[pos] == 'B' and queue_t[pos + 1] == 'G':
			(queue_t[pos], queue_t[pos + 1]) = (queue_t[pos + 1], queue_t[pos])
			pos += 2
		elif queue_t[pos] == 'B' and queue_t[pos + 1] == 'B':
			pos += 1
		elif queue_t[pos] == 'G' and queue_t[pos + 1] == 'B':
			pos += 1
		else:
			pos += 1
	pos = 0
print(''.join(queue_t))


(n, t) = map(int, input().split())
l = input()
s = []
for i in l:
	s.append(i)
while t != 0:
	i = 0
	while i <= len(s) - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i + 1] = 'B'
			s[i] = 'G'
			i = i + 2
		else:
			i += 1
	t -= 1
l = ''
for i in s:
	l += i
print(l)


(N, T) = tuple(map(int, input().split(' ')))
Q = list(input())
for t in range(T):
	skip = False
	for i in range(0, len(Q) - 1):
		if skip:
			skip = False
			continue
		if Q[i] == 'B' and Q[i + 1] == 'G':
			Q[i] = 'G'
			Q[i + 1] = 'B'
			skip = True
print(''.join(Q))


import sys
a = sys.stdin.readline().strip().split(' ')
b = sys.stdin.readline().strip()
b = list(b)
start_people = int(a[0])
turns = int(a[1])
curr = 0
while curr < turns:
	temp = b.copy()
	for (index, val) in enumerate(b):
		try:
			if b[index] == 'B' and b[index + 1] == 'G':
				temp[index] = 'G'
				temp[index + 1] = 'B'
		except IndexError:
			continue
	b = temp
	curr += 1
print(''.join(b))


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
a = []
for i in range(n):
	a.append(str(s[i]))
w = 0
i = 0
while w < t:
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = (a[i + 1], a[i])
			i += 2
		else:
			i += 1
	w += 1
	i = 0
for i in range(len(a)):
	print(a[i], end='')


(numberOfPupils, time) = map(int, input().split())
queue = input()
for i in range(time):
	queue = queue.replace('BG', 'GB')
print(queue)


list = input().split()
(n, t) = (int(list[0]), int(list[1]))
str = input()
list1 = []
for i in range(n):
	list1.append(str[i])
for j in range(t):
	a = []
	for i in range(n - 1):
		if list1[i] == 'B' and list1[i + 1] == 'G':
			a.append(i)
	for i in range(n):
		if i in a:
			list1[i] = 'G'
			list1[i + 1] = 'B'
for i in range(n):
	print(list1[i], end='')


import copy
(n, t) = tuple(map(int, input().split(' ')))
q = list(input())
while t > 0:
	qt = copy.deepcopy(q)
	for i in range(n - 1):
		if qt[i] == 'B' and qt[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
	t -= 1
print(''.join(q))


(students, time) = map(int, input().split())
queue = list(input())

def update_queue():
	global queue
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
while time > 0:
	update_queue()
	time -= 1
i = 0
while i < len(queue):
	print(queue[i], sep='', end='')
	i += 1


(le, tc) = list(map(int, input().split(' ')))
s = list(input())
i = 0
for k in range(tc):
	i = 0
	while i <= le - 2:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i + 1] = 'B'
			s[i] = 'G'
			i = i + 1
		i = i + 1
for i in s:
	print(i, end='')


import sys
import math
import bisect
import itertools
import random

def main():
	(n, m) = map(int, input().split())
	A = list(input())
	for _ in range(m):
		i = 0
		while i < n:
			if i + 1 < n and A[i] == 'B' and (A[i + 1] == 'G'):
				(A[i], A[i + 1]) = (A[i + 1], A[i])
				i += 2
			else:
				i += 1
	print(''.join(A))
main()


(n, t) = map(int, input().split())
str = input()
li = []
li[:0] = str
len = len(str)
for i in range(t):
	j = 0
	while j < len - 1:
		if li[j] == 'B' and li[j + 1] == 'G':
			li[j] = 'G'
			li[j + 1] = 'B'
			j += 1
		j += 1
str1 = ''
for ele in li:
	str1 += ele
print(str1)


(l, t) = map(int, input().split())
s = input()
for j in range(t):
	temp = ''
	i = 0
	while i < l - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			temp = s[0:i] + s[i + 1] + s[i] + s[i + 2:]
			s = temp
			i += 1
		i += 1
print(s)


def take_step(q):
	i = 1
	while i < len(q):
		if q[i] == 'G' and q[i - 1] == 'B':
			(q[i - 1], q[i]) = (q[i], q[i - 1])
			i += 1
		i += 1
	return q
[n, s] = input().split()
q = list(input())
for i in range(int(s)):
	q = take_step(q)
print(''.join(q))


def seperateints(x):
	k = ''
	l = []
	for i in x:
		if i == ' ':
			l.append(int(k))
			k = ''
			continue
		k = k + i
	l.append(int(k))
	return l

def luckynum(x):
	for i in x:
		if i != '4' and i != '7':
			return False
	return True
l = seperateints(input())
s = input()
if len(s) > 1:
	for i in range(l[1]):
		kk = ''
		k = 0
		while k + 1 < len(s):
			if s[k] == 'B' and s[k + 1] == 'G':
				kk = kk + 'GB'
				k += 2
				if k + 1 == len(s):
					kk = kk + s[len(s) - 1]
					break
			else:
				kk = kk + s[k]
				if k + 1 == len(s) - 1:
					kk = kk + s[k + 1]
				k += 1
		s = kk
	print(s)
else:
	print(s)


import sys
sys.setrecursionlimit(20000)

def getlist(tcast):
	return [tcast(x) for x in input().strip().split(' ')]

def getval(tcast):
	return tcast(input().strip())

def getmatrix(r, tcast):
	mat = []
	for i in range(r):
		mat.append(getlist(tcast))
	return mat
(n, turns) = getlist(int)
line = getval(str)
line = [c for c in line]
for turn in range(turns):
	afterwards = line.copy()
	for (i, c) in enumerate(line[:-1]):
		if c == 'B' and line[i + 1] == 'G':
			(afterwards[i], afterwards[i + 1]) = ('G', 'B')
	line = afterwards
print(''.join(line))
k = 50


(n, k) = map(int, input().split())
s = input()
for i in range(k):
	s += ' '
	t = ''
	j = 0
	while j < len(s) - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			t += s[j + 1] + s[j]
			j += 1
		else:
			t += s[j]
		j += 1
	s = t
print(s)


(len_q, t) = list(map(int, input().split()))
q = list(input())
for a in range(t):
	current = 0
	while current < len_q - 1:
		if q[current] == 'B' and q[current + 1] == 'G':
			(q[current], q[current + 1]) = (q[current + 1], q[current])
			current += 2
		else:
			current += 1
print(''.join(q))


(n, t) = map(int, input().split(' '))
s = input()
if n == 1:
	print(s)
else:
	for j in range(t):
		lst = s.split('BG')
		output = ''
		for i in lst:
			output += i + 'GB'
		s = output[:n]
	print(s)


(n, t) = map(int, input().split())
s = list(input())
l = []
for i in range(t):
	for j in range(1, n):
		if s[j - 1] == 'B' and s[j] == 'G':
			l.append(j - 1)
	for j in l:
		s[j] = 'G'
		s[j + 1] = 'B'
for i in s:
	print(i, end='')


o = list(map(int, input().split()))
n = o[0]
t = o[1]
S = str(input())
s = list(S)
for i in range(t):
	a = 0
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G' and (a == 0):
			s[j] = 'G'
			s[j + 1] = 'B'
			a = 1
		elif s[j] == 'B' and s[j + 1] == 'B':
			a = 0
		elif s[j] == 'G' and s[j + 1] == 'B':
			a = 0
b = ''
print(b.join(s))


(n, k) = map(int, input().split())
queue = list(input())
new_list = queue.copy()
while k > 0:
	k -= 1
	for i in range(len(queue)):
		if i == len(queue) - 1:
			break
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(new_list[i], new_list[i + 1]) = (new_list[i + 1], new_list[i])
	queue = new_list.copy()
print(''.join(queue))


(n, t) = map(int, input().split())
result = list(input().strip())
for _ in range(t):
	i = 0
	while i < n - 1:
		if result[i] < result[i + 1]:
			(result[i], result[i + 1]) = (result[i + 1], result[i])
			i += 2
		else:
			i += 1
print(''.join(result))


(n, t) = (int(x) for x in input().split())
ch = input()
while t > 0:
	ch = ch.replace('BG', 'GB')
	t -= 1
print(ch)


(_, B) = map(int, input().split())
X = input()
for i in range(B):
	X = X.replace('BG', 'GB')
print(X)


(n, t) = [int(i) for i in input().split()]
s = list(input())
i = 0
while i < t:
	nk = 0
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			nk = 1
			j += 1
		j += 1
	if nk == 0:
		break
	i += 1
print(''.join(s))


(n, t) = map(lambda x: int(x), input().split())
queue = input()
for _ in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


inp = input().split()
n = int(inp[0])
t = int(inp[1])
str1 = input()
lst = list()
lst.append(str1)
for i in range(t):
	lst.append(lst[i].replace('BG', 'GB'))
print(lst[t])


x = list(map(int, input().split()))
string = input()
j = x[1]
while j:
	string = string.replace('BG', 'GB')
	j -= 1
print(string)


(n, t) = map(int, input().split())
s = list(input())
pos_count = []
for j in range(t):
	pos_count = []
	for i in range(n - 1):
		if s[i] < s[i + 1]:
			pos_count.append(i)
	for i in pos_count:
		(s[i], s[i + 1]) = (s[i + 1], s[i])
print(''.join(s))


(n, t) = map(int, input().split())
a = list(input())
li = []
for s in range(0, t):
	for i in range(0, n):
		if a[i:i + 2] == ['B', 'G']:
			li.append(i)
	for x in li:
		a[x:x + 2] = 'GB'
		continue
	li.clear()
print(''.join(a))


(n, t) = map(int, input().split())
s = str(input())
s = [str(z) for z in s]
for i in range(t):
	index_used = []
	for x in range(n):
		if x in index_used:
			continue
		elif x == n - 1:
			pass
		elif s[x] == 'B' and s[x + 1] == 'G':
			s[x] = 'G'
			s[x + 1] = 'B'
			index_used.append(x + 1)
print(''.join(s))


array = list(map(int, input().split(' ')))
queue = input()
n = array[0]
t = array[1]
item = 0
queue = [i for i in queue]
while item != t:
	i = 0
	while i <= n - 2:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 2
		else:
			i += 1
	item += 1
print(''.join(queue))


a = input().split()
for i in range(2):
	a[i] = int(a[i])
b = input()
c = []
for i in range(a[0]):
	c.append(b[i])
if 'B' not in c or b.index('B') == a[0] - 1:
	print(b)
else:
	for i in range(a[1]):
		j = 0
		while j < a[0] - 1:
			if c[j] == 'B' and c[j + 1] == 'G':
				c[j] = 'G'
				c[j + 1] = 'B'
				j += 2
			else:
				j += 1
	print(''.join(c))


(a, b) = input().split(' ')
queue = input()
a = int(a)
b = int(b)
for j in range(0, b):
	arr_to_replace = []
	for i in range(0, a - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			arr_to_replace.append(i)
	new = list(queue)
	for i in arr_to_replace:
		new[i] = 'G'
		new[i + 1] = 'B'
	queue = ''.join(new)
print(queue)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(N, T) = map(int, input().split())
S = list(input())
for i in range(T):
	t = [''] * N
	j = 0
	while j < N:
		if j < N - 1 and S[j] == 'B' and (S[j + 1] == 'G'):
			t[j] = 'G'
			t[j + 1] = 'B'
			j += 2
		else:
			t[j] = S[j]
			j += 1
	S = t
print(''.join(S))


(n, k) = [int(x) for x in input().split()]
s = input()
s = list(s)
m = s[:]
while k:
	k -= 1
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			m[i] = 'G'
			m[i + 1] = 'B'
	s = m[:]
print(''.join(s))


(n, k) = map(int, input().strip().split())
w = input()
a = list(w)
while k > 0:
	i = 0
	while i < n - 1:
		if a[i] == 'B' and a[i + 1] == 'G':
			(a[i], a[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
	k -= 1
print(''.join((i for i in a)))


import re
(n, t) = map(int, input().split())
q = input()
for x in range(t):
	q = re.sub('BG', 'GB', q)
print(q)


(n, t) = input().split()
string = input()
l = []
for i in string:
	l.append(i)
for i in range(int(t)):
	exchange = []
	for i in range(len(l) - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			exchange.append(i)
	for i in exchange:
		temp = l[i]
		l[i] = l[i + 1]
		l[i + 1] = temp
newstr = ''
for i in l:
	newstr += i
print(newstr)


(n, t) = map(int, input().split())
queue = input()
x = []
if 'BG' not in queue:
	print(queue)
else:
	queue_list = list(queue)
	while t > 0:
		for i in range(n - 1):
			if queue_list[i] == 'B' and queue_list[i + 1] == 'G':
				x += [i]
		for i in range(len(x)):
			queue_list[x[i]] = 'G'
			queue_list[x[i] + 1] = 'B'
		t -= 1
	print(''.join(queue_list))


(n, t) = input().split()
n = int(n)
t = int(t)
swap = ''
answer = ''
listt = list(input())
for i in range(t):
	for j in range(1, n, 1):
		if swap == '':
			if listt[j - 1] == 'B' and listt[j] == 'G':
				swap = listt[j - 1]
				listt[j - 1] = listt[j]
				listt[j] = swap
		else:
			swap = ''
		if j == n - 1:
			swap = ''
for i in listt:
	answer += i
print(answer)


(n, t) = map(int, input().split())
l = input()
s = []
for i in range(len(l)):
	s.append(l[i])
for i in range(t):
	p = s.copy()
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			p[j] = 'G'
			p[j + 1] = 'B'
	s = p
o = ''
for i in s:
	o += i
print(o)


(n, t) = input().split()
s = input()
n = int(n)
t = int(t)
l = []
for i in range(t):
	for i in range(n):
		l.insert(i, s[i])
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			l[j] = 'G'
			l[j + 1] = 'B'
	s = ''
	for k in range(n):
		s = s + l[k]
print(s)


(n, t) = [int(x) for x in input().split()]
queue = list(input())
switch = 0
for i in range(t):
	temp = queue
	for j in range(n):
		if switch == 1:
			switch = 0
		elif j == n - 1:
			pass
		elif queue[j] == 'B' and queue[j + 1] == 'G':
			(temp[j], temp[j + 1]) = (queue[j + 1], queue[j])
			switch = 1
		else:
			pass
	queue = temp
print(''.join(queue))


tausch = input().split()
for (i, j) in enumerate(tausch):
	tausch[i] = int(tausch[i])
que = input().upper()
listque = list(que)
i = 0
while i < tausch[1]:
	j = 0
	while j < len(que) - 1:
		if listque[j] == 'B' and listque[j + 1] == 'G':
			listque[j] = 'G'
			listque[j + 1] = 'B'
			j += 1
		else:
			pass
		j += 1
	i += 1
print(''.join(listque))


(n, t) = [int(x) for x in input().split()]
lis = []
l = input()
time = int(0)
l = list(l)

def Check_item(a):
	i = int(0)
	for z in range(0, t):
		global time
		time += 1
		lis.clear()
		for x in range(0, n - 1):
			if l[x] == 'B' and l[x + 1] == 'G':
				lis.append(x)
		SwapBG()

def SwapBG():
	for y in lis:
		l[y] = 'G'
		l[y + 1] = 'B'
	if time == t:
		print(''.join(l))
Check_item(l)


(a, b) = input().split()
a = int(a)
b = int(b)
c = input()
d = [i for i in range(a)]
for i in range(a):
	d[i] = c[i]
for i in range(b):
	j = 0
	while j < a - 1:
		if d[j] == 'B':
			if d[j + 1] == 'G':
				d[j] = 'G'
				d[j + 1] = 'B'
				j += 1
		j += 1
for i in range(a - 1):
	print(d[i], end='')
print(d[a - 1])


l = list(map(int, input().split()))
s = list(input())
while l[1] > 0:
	i = 0
	while i < l[0] - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i = i + 1
		i = i + 1
	l[1] -= 1
st = ''
st = st.join(s)
print(st)


def swapBG(bgList):
	index = 0
	while index < len(bgList) - 1:
		if bgList[index] == 'B' and bgList[index + 1] == 'G':
			bgList[index] = 'G'
			bgList[index + 1] = 'B'
			index += 1
		index += 1
	return bgList
inputList = [int(x) for x in input().split()]
bgList = list(input())
for tick in range(inputList[1]):
	bgList = swapBG(bgList)
print(''.join(bgList))


(n, t) = map(int, input().split())
s = input()
lst = []
l2 = iter(range(n - 1))
for j in range(t):
	l2 = iter(range(n - 1))
	for i in l2:
		if s[i] == 'B' and s[i + 1] == 'G':
			for k in range(n):
				lst += s[k]
			lst[i] = 'G'
			lst[i + 1] = 'B'
			s = ''
			for l in range(n):
				s += lst[l]
			lst = []
			if i == n - 2:
				pass
			else:
				l2.__next__()
		else:
			pass
print(s)


def f(a, n):
	for i in range(n):
		j = 0
		while j < len(a) - 1:
			if a[j] == 'B':
				if a[j + 1] == 'G':
					(a[j + 1], a[j]) = (a[j], a[j + 1])
					j += 2
				else:
					j += 1
			else:
				j += 1
	return ''.join(a)
(_, n) = input().split()
a = list(input())
print(f(a, int(n)))


def main():
	(n, m) = [int(v) for v in input().split()]
	a = list(input())
	for j in range(0, m):
		i = 1
		while i < n:
			if a[i - 1] == 'B' and a[i] == 'G':
				a[i - 1] = 'G'
				a[i] = 'B'
				i += 2
			else:
				i += 1
	print(''.join(a))
main()


params = input().strip().split()
n = int(params[0])
T = int(params[1])
queue = [c for c in input()]
for t in range(T):
	prev_queue = queue
	i = 0
	while i < len(queue) - 1:
		if prev_queue[i] == 'B' and prev_queue[i + 1] == 'G':
			queue[i] = 'G'
			queue[i + 1] = 'B'
			i += 2
		else:
			i += 1
print(''.join(queue))


s = input()
a = s.split()
for i in range(len(a)):
	a[i] = int(a[i])
s = input()
b = []
for i in range(len(s)):
	b.append(s[i])
while a[1] > 0:
	i = 0
	while i < len(b) - 1:
		if b[i] == 'B' and b[i + 1] == 'G':
			b[i] = 'G'
			b[i + 1] = 'B'
			i += 1
		i += 1
	a[1] -= 1
for i in range(len(b)):
	print(b[i], end='')


(n, k) = map(int, input().split())
s = input()
ar = [i for i in s]
for i in range(k):
	i = 0
	while i < n - 1:
		if ar[i] == 'B' and ar[i + 1] == 'G':
			(ar[i], ar[i + 1]) = (ar[i + 1], ar[i])
			i += 2
		else:
			i += 1
r = ''
r += ''.join((i for i in ar))
print(r)


def physicist():
	(n, t) = [int(i) for i in input().split(' ')]
	q = list(input())
	for i in range(t):
		j = 1
		while j < n:
			if q[j] == 'G' and q[j - 1] == 'B':
				q[j] = 'B'
				q[j - 1] = 'G'
				j += 2
			else:
				j += 1
	print(''.join(q))
physicist()


(a, k) = map(int, input().split())
queue = list(input())
for j in range(k):
	i = 0
	while i < a - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(queue[i], queue[i + 1]) = (queue[i + 1], queue[i])
			i += 1
		i += 1
print(''.join(queue))


(a, b) = map(int, input().split())
str = list(input())
j = 0
for i in range(b):
	boo = False
	for j in range(len(str) - 1):
		if boo == True:
			boo = False
			continue
		if str[j] == 'B' and str[j + 1] == 'G':
			str[j] = 'G'
			str[j + 1] = 'B'
			boo = True
ans = ''
print(ans.join(str))


(x, y) = input().split()
(x, y) = (int(x), int(y))
a = input()
s = list(a)
for j in range(y):
	a = ''.join(s)
	for i in range(x - 1):
		if a[i] == 'B' and a[i + 1] == 'G':
			(s[i], s[i + 1]) = (a[i + 1], a[i])
print(''.join(s))


from sys import stdin, stdout
import math

def get_index(string):
	index = []
	for i in range(len(string)):
		if string[i] == 'B':
			index.append(i)
	return index
(n, t) = list(map(int, stdin.readline().split()))
string = list(stdin.readline().strip())
index = get_index(string)
tarr = [t] * len(index)
flag = 0
cstring = string[:]
while flag == 0:
	flag = 1
	string = cstring[:]
	for i in range(len(index) - 1, -1, -1):
		if index[i] + 1 < n:
			if string[index[i] + 1] == 'G' and tarr[i] > 0:
				flag = 0
				(cstring[index[i]], cstring[index[i] + 1]) = (cstring[index[i] + 1], cstring[index[i]])
				index[i] += 1
	for i in range(len(tarr)):
		tarr[i] -= 1
print(''.join(string))


(n, t) = map(int, input().split())
q = input()

def get_s(q):
	s = ''
	i = 0
	while i < n - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			s += 'GB'
			i += 2
		else:
			s += q[i]
			i += 1
	if len(s) == n - 1:
		s += q[n - 1]
	return s
for _ in range(t):
	q = get_s(q)
print(q)


x = input().split()
n = int(x[0])
t = int(x[1])
q = input()
for j in range(t):
	q = q.replace('BG', 'GB')
print(q)


def solve():
	t = int(input()[2:])
	s = input()
	while t:
		s = s.replace('BG', 'GB')
		t -= 1
	print(s)
solve()


(n, t) = map(int, input().split())
a = list(input())
b = a[:]
for i in range(t):
	b[0] = a[0]
	for j in range(1, n):
		if a[j] == 'G' and a[j - 1] == 'B':
			b[j - 1] = 'G'
			b[j] = 'B'
		else:
			b[j] = a[j]
	a = b[:]
for i in range(n):
	print(a[i], end='')


(n, t) = [int(x) for x in input().split()]
wor = input()
word1 = list(wor)
for i in range(t):
	word2 = word1[:]
	for j in range(1, len(wor)):
		if word1[j] == 'G' and word1[j - 1] == 'B':
			word2[j] = 'B'
			word2[j - 1] = 'G'
	word1 = word2[:]
for i in range(len(wor)):
	print(word1[i], end='')


(a, b) = map(int, input().split())
c = input()
d = []
e = []
for i in range(a):
	if c[i] == 'B':
		d.append(1)
	else:
		d.append(0)
t = 0
for j in range(b):
	t = 0
	while t < a:
		if t == a - 1:
			break
		if d[t] == 1 and d[t + 1] == 0:
			d[t + 1] = 1
			d[t] = 0
			t = t + 1
		t = t + 1
for i in range(a):
	if d[i] == 1:
		e.append('B')
	else:
		e.append('G')
print(''.join(e))


number = list(map(int, input().split()))
line = str(input())
count = 0
if number[0] > 1:
	while True:
		linenew = ''
		if line[0] == 'B' and line[1] == 'G':
			linenew += 'G'
		else:
			linenew += line[0]
		for j in range(1, number[0]):
			if line[j] == 'B' and line[j + 1:] == 'G' + line[j + 2:]:
				linenew += 'G'
			elif line[j] == 'G' and line[:j] == line[:j - 1] + 'B':
				linenew += 'B'
			else:
				linenew += line[j]
		count += 1
		line = linenew
		if count == number[1]:
			break
else:
	linenew = line
print(linenew)


def switch(a):
	i = 1
	while i < len(a):
		if a[i] == 'G' and a[i - 1] == 'B':
			a = a[:i - 1] + a[i] + a[i - 1] + a[i + 1:]
			i += 1
		i += 1
	return a
(n, t) = map(int, input().split())
a = input()
for i in range(t):
	a = switch(a)
print(a)


(n, t) = input().split()
(n, t) = [int(n), int(t)]
queue = [x for x in input()]
final_queue = []
for _t in range(t):
	i = 0
	while i < n - 1:
		if queue[i + 1] == 'G' and queue[i] == 'B':
			final_queue.append(i + 1)
			final_queue.append(i)
			i += 2
		else:
			final_queue.append(i)
			i += 1
	last_element = queue[-1]
	queue = [queue[x] for x in final_queue]
	if len(final_queue) < n:
		queue.append(last_element)
	final_queue = []
for x in queue:
	print(x, end='')


def school():
	(n, t) = input().split()
	n = int(n)
	t = int(t)
	s = input()
	i = 0
	while t != 0:
		if 'BG' in s:
			s = s.replace('BG', 'GB')
		t = t - 1
	print(s)
school()


(p, q) = map(int, input().split(' '))
a = list(input())
for i in range(0, q):
	j = 0
	while j < p:
		if a[j] in 'B' and j < p - 1:
			if a[j + 1] in 'G':
				w = a[j]
				(a[j], a[j + 1]) = (a[j + 1], a[j])
				a[j + 1] = w
				j = j + 1
		j = j + 1
print(''.join(a))


x = input().split(' ')
n = int(x[0])
t = int(x[1])
y = list(input())
i = 0
j = 0
while i < t:
	while j + 1 < n:
		if y[j] == 'B' and y[j + 1] == 'G':
			(y[j], y[j + 1]) = (y[j + 1], y[j])
			j += 2
		else:
			j += 1
	j = 0
	i += 1
output = ''.join(y)
print(output)


(n, t) = list(map(int, input().split()))
if n > 1:
	a = list(map(str, input()))
	for _ in range(t):
		p1 = 0
		p2 = 1
		while p1 < n and p2 < n:
			if a[p1] == 'B' and a[p2] == 'G':
				(a[p1], a[p2]) = (a[p2], a[p1])
				p1 = p2 + 1
				p2 = p1 + 1
			else:
				p1 = p1 + 1
				p2 = p2 + 1
	print(''.join(a))
else:
	print(input())


def bg():
	r = []
	k = 0
	(n, t) = map(int, input().split())
	s = list(input())
	for i in range(1, t + 1, 1):
		while k < len(s):
			if k >= len(s) - 1:
				break
			elif s[k] == 'B' and s[k + 1] == 'G':
				(s[k], s[k + 1]) = (s[k + 1], s[k])
				k = k + 1
			k += 1
		k = 0
	r = ''.join(s)
	return str(r)
print(bg())


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
(n, i) = get_int_list()
s = get_string()
for _ in range(i):
	if 'BG' in s:
		s = s.replace('BG', 'GB')
	else:
		break
print(s)


import sys
d = int(input().split()[1])
f = list(input())
if f.count('B') == 0:
	print(''.join(f))
	sys.exit(0)
t = 0
while d > 0:
	bs = [int(i) for (i, j) in enumerate(f) if j == 'B']
	for t in bs:
		try:
			if f[t] == 'B' and f[t + 1] == 'G':
				(f[t], f[t + 1]) = (f[t + 1], f[t])
		except:
			pass
	d -= 1
print(''.join(f))


(n, t) = map(int, input().split())
s = input()
for k in range(t):
	i = 0
	q = ''
	while i < n - 1:
		if ord(s[i]) < ord(s[i + 1]):
			q += 'GB'
			i += 2
		else:
			q += s[i]
			i += 1
	if len(q) < n:
		q += s[n - 1]
	s = q
print(s)


(n, time) = map(int, input().split())
s = input()
s = list(s)
for _ in range(time):
	i = 1
	while i < n:
		if s[i] == 'G' and s[i - 1] == 'B':
			(s[i], s[i - 1]) = (s[i - 1], s[i])
			i = i + 1
		i += 1
for j in range(n):
	print(s[j], end='')


(n, k) = list(map(int, input().split()))
l = str(input())
for i in range(k):
	l = l.replace('BG', 'GB')
print(l)


a = input()
numbers = a.split(' ')
n = int(numbers[0])
time = int(numbers[1])
que = input()
t = 0
s = 0

def replaceString(string, num, replace):
	string2 = ''
	for i in range(0, len(string)):
		if i == num:
			string2 += replace
		else:
			string2 += string[i]
	return string2
while t < time:
	while s < n - 1:
		if que[s] == 'B' and que[s + 1] == 'G':
			que = replaceString(que, s, 'G')
			que = replaceString(que, s + 1, 'B')
			s += 2
		else:
			s += 1
	t += 1
	s = 0
print(que)


(n, t) = map(int, input().split())
q = list(input())

def reQueue(q):
	count = 0
	while count < n - 1:
		if q[count] == 'B' and q[count + 1] == 'G':
			(q[count], q[count + 1]) = ('G', 'B')
			count += 2
		else:
			count += 1
for t in range(t):
	reQueue(q)
print(''.join(map(str, q)))


(n, t) = map(int, input().split())
s = input() + '1'
j = 1
while j <= t:
	i = 0
	a = ''
	while i < n:
		if s[i] == 'B':
			if s[i + 1] == 'G':
				a += 'GB'
				i += 2
			elif s[i + 1] == 'B':
				a += 'B'
				i += 1
			else:
				a += s[i]
				break
		elif s[i] == 'G':
			a += 'G'
			i += 1
		else:
			a += ''
			i += 1
			break
	s = a + '1'
	j += 1
print(a)


def step(s):
	n = list(s)
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			n[i] = 'G'
			n[i + 1] = 'B'
	return ''.join(n)
(n, t) = input().split()
(n, t) = (int(n), int(t))
x = input()
for i in range(t):
	x = step(x)
print(x)


(n, t) = [int(i) for i in input().strip().split()]
s = input()
for i in range(t):
	ans = ''
	k = s.find('BG')
	while k != -1:
		ans += s[:k] + 'GB'
		s = s[k + 2:]
		k = s.find('BG')
	ans += s
	s = ans
print(s)


import sys
inputs = sys.stdin.readline().split()
n = int(inputs[0])
t = int(inputs[1])
sQueue = sys.stdin.readline().strip()
for sec in range(t):
	flag = False
	for i in range(n):
		if flag:
			flag = False
			continue
		if sQueue[i] == 'B' and i != n - 1 and (sQueue[i + 1] == 'G'):
			sQueue = sQueue[:i] + sQueue[i + 1] + sQueue[i] + sQueue[i + 2:]
			flag = True
print(sQueue)


(n, t) = input().split(' ')
queue = input()
n = int(n)
t = int(t)
q = []
r = []
for k in range(n):
	q.append(queue[k])
	r.append(queue[k])
for i in range(t):
	q = []
	for k in range(n):
		q.append(r[k])
	for j in range(n - 1):
		if q[j] == 'B' and q[j + 1] == 'G':
			r[j] = 'G'
			r[j + 1] = 'B'
for i in range(n):
	print(r[i], end='')


(n, t) = input().split()
q = input() + 'N'
newQ = ''
skip = 0
for i in range(int(t)):
	for j in range(int(n)):
		if skip == 1:
			skip = 0
			continue
		if q[j] == 'G' and q[j + 1] == 'G':
			newQ += 'G'
		elif q[j] == 'G' and q[j + 1] == 'B':
			newQ += 'G'
		elif q[j] == 'B' and q[j + 1] == 'G':
			newQ += 'GB'
			skip = 1
		elif q[j] == 'B' and q[j + 1] == 'B':
			newQ += 'B'
		elif q[j] == 'B' and q[j + 1] == 'N':
			newQ += 'B'
		elif q[j] == 'G' and q[j + 1] == 'N':
			newQ += 'G'
	result = newQ
	q = newQ + 'N'
	newQ = ''
print(result)


def chPathToThis(f=None):
	import os
	f = __file__ if f is None else f
	os.chdir(os.path.dirname(f))
fle = None

def input():
	global fle

	def inner():
		if fle is None:
			from sys import stdin
			for line in stdin:
				yield line
			raise EOFError
		else:
			for line in fle:
				yield line.replace('\r', '').replace('\n', '')
			raise EOFError
	o = inner()
	return next(o)

def main():
	(n, t) = map(int, input().split())
	s = [e for e in input()]
	for time in range(t):
		i = 0
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = ('G', 'B')
				i += 1
			i += 1
	print(''.join(s))
try:
	import time, numpy
	chPathToThis(__file__)
	(begin, fle) = (time.clock(), open('pytest.txt'))
	main()
	fle.close()
	print(time.clock() - begin)
except ImportError:
	main()


import sys
(n, t) = map(int, input().split())
li = list(input())
n -= 1
j = 0
for i in range(t):
	j = 0
	while j < n:
		if li[j] == 'B' and li[j + 1] == 'G':
			li[j + 1] = 'B'
			li[j] = 'G'
			j += 1
		elif li[j] == 'G' and li[j + 1] == 'G':
			li[j] = 'G'
			li[j + 1] = 'G'
			j += 1
		elif li[j] == 'G' and li[j + 1] == 'B':
			if j + 2 <= n:
				if li[j + 2] == 'G':
					li[j] = 'G'
				elif li[j + 2] == 'B':
					li[j] = 'G'
					li[j + 1] = 'B'
					j += 1
			else:
				li[j] = 'G'
				li[j + 1] = 'B'
		elif li[j] == 'B' and li[j + 1] == 'B':
			if j + 2 <= n:
				if li[j + 2] == 'G':
					li[j] = 'B'
				elif li[j + 2] == 'B':
					li[j] = 'B'
					li[j + 1] = 'B'
					j += 1
			else:
				li[j] = 'B'
				li[j + 1] = 'B'
		j += 1
li1 = ''
for i in li:
	li1 += i
print(li1)


(n, x) = map(int, input().split())
arr = input()
i = 0
while i < x:
	j = 0
	while j < n - 1:
		if arr[j] == 'B' and arr[j + 1] == 'G':
			arr = arr[:j] + 'GB' + arr[j + 2:]
			j += 2
		else:
			j += 1
	i += 1
print(arr)


a = [int(i) for i in input().split()]
b = list(input())
t = a[1]
while t > 0:
	t -= 1
	c = 0
	while c < a[0] - 1:
		if b[c] == 'B' and b[c + 1] == 'G':
			b[c] = 'G'
			b[c + 1] = 'B'
			c += 2
		else:
			c += 1
			continue
print(''.join(b))


userIO = input().split()
n = int(userIO[0])
t = int(userIO[1])
queue = list(input())
for i in range(t):
	found = False
	for j in range(0, n - 1):
		if found:
			found = False
			continue
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j], queue[j + 1]) = (queue[j + 1], queue[j])
			found = True
print(''.join(queue))


def get_new_queue(queue, x):
	for i in range(x):
		queue_copy = queue.copy()
		for k in range(len(queue)):
			if k <= len(queue) - 2:
				if queue_copy[k] == 'B' and queue_copy[k + 1] == 'G':
					queue[k] = 'G'
					queue[k + 1] = 'B'
	return ''.join(queue)

def main():
	(num_in_queue, x) = [int(i) for i in input().split()]
	queue = ' '.join(input()).split()
	new_queue = get_new_queue(queue, x)
	print(new_queue)
main()


(n, t) = input().split()
n = int(n)
t = int(t)
string = input()
listOfChildren = list(string)
counter = 0
updatedLength = 0

def swapFunction(firstIndex, secondIndex):
	(listOfChildren[firstIndex], listOfChildren[secondIndex]) = (listOfChildren[secondIndex], listOfChildren[firstIndex])
for i in range(t):
	for j in range(n - 1):
		if listOfChildren[counter] == 'B' and listOfChildren[counter + 1] == 'G':
			swapFunction(counter, counter + 1)
			if counter == n - 2:
				break
			counter = counter + 1
		if counter == n - 2:
			break
		counter = counter + 1
	counter = 0
answer = ''.join(listOfChildren)
print(answer)


ta = input().split()
t = int(ta[1])
st = list(input())
while t > 0:
	i = 0
	while i < len(st) - 1:
		if st[i] == 'B' and st[i + 1] == 'G':
			(st[i], st[i + 1]) = (st[i + 1], st[i])
			i += 2
		else:
			i += 1
	t -= 1
print(''.join(st))


a = input().split()
time = int(a[1])
b = list(input())
str = ''
i = 0
for j in range(time):
	while i <= len(b) - 2:
		if b[i] == 'B' and b[i + 1] == 'G':
			(b[i], b[i + 1]) = (b[i + 1], b[i])
			i = i + 2
		else:
			i = i + 1
	i = 0
for i in range(len(b)):
	str = str + b[i]
print(str)


(n, t) = list(map(int, input().strip().split(' ')))
line = input().strip().split(' ')
line = line[0]

def rev(Str):
	s = ''
	i = 0
	while i < n - 1:
		if Str[i:i + 2] == 'BG':
			s += 'GB'
			i += 2
		else:
			s += Str[i]
			i += 1
	if len(s) != n:
		s += Str[-1]
	return s
while t > 0:
	line = rev(line)
	t -= 1
print(line)


(n, t) = input().split()
(n, t) = (int(n), int(t))
s = input()
for y in range(t):
	s = s + '0'
	new_s = ''
	for i in range(n):
		if s[i] + s[i + 1] == 'BG':
			new_s = new_s + 'GB'
		elif s[i] == 'G' and s[i - 1] != 'B':
			new_s = new_s + 'G'
		elif s[i] == 'B' and s[i + 1] != 'G':
			new_s = new_s + 'B'
	s = new_s
print(new_s)


(r, t) = [int(i) for i in input().split()]
s = input()
p = ''
for i in range(t):
	j = 0
	while j < len(s):
		if j + 1 < len(s) and s[j] == 'B' and (s[j + 1] == 'G'):
			p += 'GB'
			j += 2
		else:
			p += s[j]
			j += 1
	s = p
	p = ''
print(s)


(m, n) = map(int, input().split())
bg = input()
cnt = 0
while cnt < n:
	bg = bg.replace('BG', 'GB')
	cnt = cnt + 1
print(bg)


(n, m) = map(int, input().split())
n1 = list(input())
e = ''
while m > 0:
	j = 0
	while j < n - 1:
		if n1[j] == 'B' and n1[j + 1] == 'G':
			(n1[j], n1[j + 1]) = (n1[j + 1], n1[j])
			j = j + 1
		j = j + 1
	m = m - 1
print(''.join(n1))


pp = input().split()
n = int(pp[0])
t = int(pp[1])
a = str(input())
l = list(a)
while t > 0:
	t -= 1
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l.pop(i + 1)
			l.pop(i)
			l.insert(i, 'G')
			l.insert(i + 1, 'B')
			i += 2
		else:
			i += 1
w = ''.join(l)
print(w)


(m, n) = map(int, input().split())
Seq = input()
for i in range(n):
	Seq = 'GB'.join(Seq.split('BG'))
print(Seq)


(n, k) = map(int, input().split())
s = str(input())
pos_bys = [i for (i, ch) in enumerate(s) if ch == 'B']
le = len(pos_bys)
for i in range(k):
	for j in range(len(pos_bys)):
		if j == le - 1:
			if pos_bys[j] < n - 1:
				pos_bys[j] += 1
		elif pos_bys[j + 1] != pos_bys[j] + 1:
			pos_bys[j] += 1
res = ''
for i in range(n):
	if i in pos_bys:
		res += 'B'
	else:
		res += 'G'
print(res)


x = list(map(int, input().split()))
y = input()
for i in range(x[1]):
	y = y.replace('BG', 'GB')
print(y)


(n, t) = map(int, input().split(' '))
queue = input()
people = []
for i in queue:
	people.append(i)
for j in range(t):
	i = 0
	while i < n - 1:
		if people[i] == 'B' and people[i + 1] == 'G':
			t = people[i]
			people[i] = people[i + 1]
			people[i + 1] = t
			i += 2
		else:
			i += 1
result = ''
for i in people:
	result += i
print(result)


(n, t) = map(int, input().split())
s = input()
s1 = list(s)
for k in range(t):
	for (i, st) in enumerate(s1[:-1]):
		if st == 'B' and s1[i + 1] == 'G':
			(s1[i], s1[i + 1]) = (s1[i + 1], s1[i])
print(''.join(s1))


(n, t) = map(int, input().split(' '))
st = input()
List_1 = [0] * n
for i in range(n):
	List_1[i] = st[i]
List = List_1[:]
for x in range(t):
	for k in range(n - 1):
		if List_1[k] == 'B':
			(List[k], List[k + 1]) = (List[k + 1], List[k])
	List_1 = List[:]
for m in range(n):
	print(List[m], end='')


line = []
free = ['B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B']
(count, time) = map(int, input().split())
string = input()
string1 = ''
for c in string:
	line.append(c)
line += free
for _ in range(time):
	n = 0
	for _ in range(count):
		if line[n] == 'B' and line[n + 1] == 'G':
			line[n] = 'G'
			line[n + 1] = 'B'
			n += 1
			if line[n] == 'B' and line[n + 1] == 'G':
				n += 1
		else:
			n += 1
line.pop()
line.pop()
line.pop()
n = 0
for i in range(count):
	string1 += line[n]
	n += 1
print(string1)


(n, t) = [int(i) for i in input().split(' ')]
s = list(input())
s_ = s.copy()
for i in range(t):
	for i in range(len(s) - 1, 0, -1):
		if s[i] == 'G' and s[i - 1] == 'B':
			s_.insert(i - 1, s_.pop(i))
	s = s_.copy()
print(''.join(s_))


L = list(map(int, input().rstrip().split()))
n = L[1]
queue = list(input())
for x in range(n):
	i = 0
	j = i + 1
	while j < len(queue):
		if queue[i] == 'B' and queue[j] == 'G':
			swap = queue[i]
			queue[i] = queue[j]
			queue[j] = swap
			i = j + 1
			j = i + 1
		else:
			i = i + 1
			j = j + 1
print(''.join(queue))


l = [int(x) for x in input().split()]
line = input()
line = list(line)
size = l[0]
for i in range(l[1]):
	j = 0
	while j < size - 1:
		if line[j] == 'B' and line[j + 1] == 'G':
			(line[j], line[j + 1]) = (line[j + 1], line[j])
			j = j + 1
		j = j + 1
line = ''.join(line)
print(line)


numbers = list(map(int, input().split()))
bgI = input()
bg = list(bgI)
numOfbg = numbers[0]
time = numbers[1]
posIndx = []

def boyspos():
	for i in range(len(bg) - 1):
		ch1 = bg[i]
		if ch1 == 'B':
			ch2 = bg[i + 1]
			if ch2 == 'G':
				posIndx.append(i)
boyspos()
for t in range(time):
	for pos in posIndx:
		ch = bg[pos + 1]
		bg[pos + 1] = bg[pos]
		bg[pos] = ch
	posIndx = []
	boyspos()
print(''.join(bg))


(n, t) = input().split()
n = int(n)
t = int(t)
ori_str = input()
ori_list = list(ori_str)
long = len(ori_list)
order = [idx for (idx, i) in enumerate(ori_list) if i == 'B']
if ori_list.count('G') != 0:
	while t > 0:
		for idx in order:
			if idx + 1 <= long - 1:
				if ori_list[idx + 1] == 'G':
					ori_list[idx + 1] = 'B'
					ori_list[idx] = 'G'
			elif idx == long - 1:
				ori_list[idx] = 'B'
		order = [idx for (idx, i) in enumerate(ori_list) if i == 'B']
		t = t - 1
print(''.join(ori_list))


(a, b) = map(int, input().split())
n = input()
l = list(n)
count = 0
for x in range(b):
	l1 = []
	for i in range(len(n) - 1):
		if l[i] == 'B':
			l1.append(i)
	for i in l1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
print(''.join(l))


(n, t) = map(int, input().split())
s = input()
list1 = []
for i in s:
	list1.append(i)
list2 = list1 + []
for j in range(t):
	for i in range(len(list1) - 1):
		if list1[i] == 'B' and list1[i + 1] == 'G':
			list2[i] = 'G'
			list2[i + 1] = 'B'
	list1 = list2 + []
print(*list2, sep='')


info = input()
sec = int(info.split()[-1])
queue = list(input())
ini = 0
while ini < sec:
	queue_copy = queue[:]
	for i in range(len(queue) - 1):
		if queue_copy[i] == 'B' and queue_copy[i + 1] == 'G':
			queue[i] = 'G'
			queue[i + 1] = 'B'
	ini += 1
print(''.join(queue))


a = input().split()
qu = int(a[0])
t = int(a[-1])
x = input()
x = list(x)
while t != 0:
	for i in range(qu - 1):
		if x[i] == 'B' and x[i + 1] == 'G':
			(x[i], x[i + 1]) = ('X', 'X')
	x = ''.join(x)
	if x.count('XX') == 0:
		break
	x = x.replace('XX', 'GB')
	x = list(x)
	t -= 1
x = ''.join(x)
print(x)


(n, time) = [int(x) for x in input().split()]
string = input()
strl = []
for x in string:
	strl += [x]
while time > 0:
	j = 0
	while j < n - 1:
		if strl[j] == 'B' and strl[j + 1] == 'G':
			temp = strl[j]
			strl[j] = strl[j + 1]
			strl[j + 1] = temp
			j += 2
		else:
			j += 1
	time -= 1
a = ''
for i in range(n):
	a += strl[i]
print(a)


(n, t) = tuple(map(int, input().split()))
q = input()
for i in range(t):
	sw = []
	for c in range(len(q) - 1):
		if q[c] == 'B' and q[c + 1] == 'G':
			sw.append(c)
	for c in range(len(q)):
		if c in sw:
			q = q[:c] + 'GB' + q[c + 2:]
print(q)


try:
	(k, s) = map(int, input().split())
	b = input()
	while s > 0:
		for i in range(0, len(b) + 1, 2):
			b = b.replace('BG', 'GB')
			s = s - 1
			if s <= 0:
				break
	print(b)
except:
	pass


(ludi, sekund) = map(int, input().split())
ludia = list(input())
for sekunda in range(sekund):
	novy_ludia = []
	i = 0
	while i <= ludi - 2:
		if ludia[i] == 'B' and ludia[i + 1] == 'G':
			novy_ludia.extend(['G', 'B'])
			i += 1
		else:
			novy_ludia.append(ludia[i])
		i += 1
	while i <= ludi - 1:
		novy_ludia.append(ludia[i])
		i += 1
	ludia = novy_ludia
print(''.join(ludia))


(c, b) = map(int, input().split())
s = str(input())
a = ''
for i in range(b):
	j = 0
	while j < c - 1:
		if str(s[j]) < str(s[j + 1]):
			a += str(s[j + 1])
			a += str(s[j])
			j += 2
		else:
			a += str(s[j])
			j += 1
	if j == c - 1:
		a += str(s[j])
	s = a
	a = ''
print(s)


(n, t) = map(int, input().split())
s = input()
r = list()
r.append(s.replace('BG', 'GB'))
for i in range(1, t):
	r.append(r[i - 1].replace('BG', 'GB'))
print(r[t - 1])


(n, t) = [int(x) for x in input().split()]
s = input()
l = []
for c in s:
	l.append(c)
for i in range(t):
	ind = 0
	for c in l:
		if ind < len(l) - 1 and l[ind] == 'B' and (l[ind + 1] == 'G'):
			l[ind] = 'G'
			l[ind + 1] = 'B'
			ind += 2
		else:
			ind += 1
for i in l:
	print(i, end='')


def main():
	(n, t) = map(int, input().split())
	s = list(input())
	i = 0
	time = t
	while time > 0:
		if i == len(s):
			time -= 1
			i = 0
		elif i <= len(s) - 2 and s[i] == 'B' and (s[i + 1] == 'G'):
			k = s[i]
			(s[i], s[i + 1]) = (s[i + 1], k)
			i += 2
		else:
			i += 1
	print(''.join(s))
main()


(rang, time) = list(map(int, input().split()))[:]
_q = list(input().lower())
for _f in range(time):
	pos = rang - 1
	while pos > 0:
		(a, b) = (pos, pos - 1)
		if _q[a] != _q[b] and _q[a] == 'g':
			(_q[a], _q[b]) = (_q[b], _q[a])
			pos -= 2
		else:
			pos -= 1
print(''.join((x.upper() for x in _q)))


(x, y) = [int(k) for k in input().split()]
s = input()
t = s
for z in range(y):
	for w in range(x - 1):
		if s[w:w + 2] == 'BG':
			t = t[:w] + 'GB' + t[w + 2:]
	s = t
print(s)


(a, b) = map(int, input().split())
s = list(input())
for i in range(b):
	s2 = s.copy()
	for j in range(a - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			(s2[j], s2[j + 1]) = (s2[j + 1], s2[j])
	s = s2.copy()
print(''.join(s))


import re
nl = input()
lin = input()
line = list(lin)
num = re.compile('\\d{2}|\\d')
nums = num.findall(nl)
n = int(nums[0])
t = int(nums[1])
for i in range(1, t + 1):
	nl1 = line.copy()
	for o in range(n - 1):
		if line[o] == 'B' and line[o + 1] == 'G':
			nl1.pop(o)
			nl1.insert(o, 'G')
			nl1.pop(o + 1)
			nl1.insert(o + 1, 'B')
	line = nl1
ans = ''.join(line)
print(ans)


(n, t) = map(int, input().split())
line = input()
for i in range(0, t):
	line = line.replace('BG', 'GB')
print(line)


n = [int(i) for i in input().split()]
data = list(input())
for i in range(n[1]):
	nData = list(data)
	for j in range(n[0] - 1):
		if data[j] == 'B' and data[j + 1] == 'G':
			nData[j] = 'G'
			nData[j + 1] = 'B'
	data = list(nData)
print(''.join(data))


(x, y) = [int(i) for i in input().split()]
boy_girl = input()
x1 = list(boy_girl)
for j in range(y):
	k = 0
	while k < x - 1:
		if x1[k] == 'B' and x1[k + 1] == 'G':
			x1[k] = 'G'
			x1[k + 1] = 'B'
			k += 2
		else:
			k += 1
print(''.join(x1))


(N, T) = input().split(' ')
N = int(N)
T = int(T)
queue = list(input())
while T != 0:
	next_queue = [None] * N
	for i in range(N):
		if i == N - 1 and next_queue[N - 1] is None:
			next_queue[N - 1] = queue[N - 1]
			break
		if queue[i] == 'B' and queue[i + 1] == 'G':
			next_queue[i] = 'G'
			next_queue[i + 1] = 'B'
		if next_queue[i] is None:
			next_queue[i] = queue[i]
	T -= 1
	queue = next_queue
print(''.join(queue))


import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def solve(n, d):
	pass

def main():
	(n, k) = ain()
	l = list(sin())
	for i in range(k):
		j = 0
		while j < n - 1:
			if l[j] == 'B' and l[j + 1] == 'G':
				(l[j], l[j + 1]) = (l[j + 1], l[j])
				j += 2
			else:
				j += 1
	print(''.join(l))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def swa(st):
	s1 = list(st)
	for i in range(len(st) - 1):
		if st[i] == 'B' and st[i + 1] == 'G':
			(s1[i], s1[i + 1]) = (s1[i + 1], s1[i])
	st = ''.join(s1)
	return st
(n, t) = map(int, input().split())
s = input()
for i in range(t):
	s = swa(s)
print(s)


(n, t) = map(int, input().split())
s = str(input())
for x in range(t):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = input().split()
(n, t) = (int(n), int(t))
l = list(input())
while t:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 1
		i += 1
	t -= 1
for x in l:
	print(x, end='')


line = input()
(N, T) = line.split()
(n, t) = (int(N), int(T))
x = input()
list1 = list(x)
for i in range(0, t, 1):
	list2 = list1[:]
	for j in range(0, n - 1, 1):
		if list2[j] == 'B' and list2[j + 1] == 'G':
			(list1[j], list1[j + 1]) = (list1[j + 1], list1[j])
hi = ''
for i in list1:
	hi = hi + i
print(hi)


a = input()
string = input()
(size, time) = [int(i) for i in a.split(' ')]
for i in range(time):
	string = string.replace('BG', 'GB')
print(string)


def swapper(s, n):
	for x in range(n):
		s = s.replace('BG', 'GB')
	return s
(m, n) = tuple(map(int, input().split()))
s = input()
print(swapper(s, n))


def main():
	(n, t) = [int(x) for x in input().split()]
	s = list(input())
	while t:
		t -= 1
		i = 0
		while i < n - 1:
			if s[i] == 'B' and s[i + 1] == 'G':
				temp = s[i + 1]
				s[i + 1] = s[i]
				s[i] = temp
				i += 1
			i += 1
	print(''.join(s))
main()


inp = input()
inpL = inp.split(' ')
n = int(inpL[0])
t = int(inpL[1])
a = input()
x = []
for c in a:
	x.append(c)
for j in range(t):
	i = 0
	while i < n - 1:
		if x[i] == 'B' and x[i + 1] == 'G':
			x[i] = 'G'
			x[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(x))


(noOfChildren, time) = list(map(int, input().split()))
queue = list(input())
for _ in range(time):
	index = 0
	while index < noOfChildren - 1:
		if queue[index] == 'B' and queue[index + 1] == 'G':
			(queue[index], queue[index + 1]) = (queue[index + 1], queue[index])
			index += 2
		else:
			index += 1
print(''.join(queue))


(numOfPeople, finalTime) = [int(x) for x in input().split()]
positions = list(input())
for i in range(finalTime):
	j = 0
	while j < numOfPeople - 1:
		if positions[j] == 'B' and positions[j + 1] == 'G':
			positions[j] = 'G'
			positions[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(positions))


def ToMutable(s):
	return list(s)

def ToImmutable(l):
	l = ''.join(l)
	return l
(n, t) = map(int, input().split(' '))
s = input().strip('')
s = ToMutable(s)
for j in range(t):
	flag = 0
	for i in range(len(s) - 1):
		if flag == 1:
			flag = 0
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			flag = 1
s = ToImmutable(s)
print(s)


l = input()
l1 = l.split(' ')
n = int(l1[0])
t = int(l1[1])
s = str(input())
for x in range(t):
	k = s.replace('BG', 'GB')
	s = k
print(k)


string = input().split(' ')
num = int(string[0])
t = int(string[1])
queue = input()
ans = ''
for sec in range(0, t):
	switch = False
	if ans != '':
		queue = ans
		ans = ''
	if num == 1:
		ans = queue
		break
	for i in range(0, num - 1):
		if switch == True:
			switch = False
		elif queue[i] == 'B' and queue[i + 1] == 'G' and (i == num - 3):
			ans += 'GB' + queue[-1]
			break
		elif queue[i] == 'B' and queue[i + 1] == 'G':
			ans += 'GB'
			switch = True
		elif i == num - 2:
			ans += queue[i] + queue[i + 1]
			break
		else:
			ans += queue[i]
print(ans)


(a, b) = map(int, input().split())
s = list(str(input()))
for i in range(b):
	m = 0
	while m < a - 1:
		if s[m] == 'B' and s[m + 1] == 'G':
			(s[m], s[m + 1]) = (s[m + 1], s[m])
			m += 1
		m += 1
k = ''
for i in s:
	k += str(i)
print(k)


(a, b) = [int(i) for i in input().split()]
start = list(input())
temp = start[:]
for i in range(0, b):
	for j in range(0, a - 1):
		if start[j] == 'B' and start[j + 1] == 'G':
			temp[j] = 'G'
			temp[j + 1] = 'B'
	start = temp[:]
print(''.join(temp))


(n, t) = map(int, input().split())
s = input()
l = list(s)
for j in range(t):
	i = 0
	while True:
		if i >= len(l):
			break
		try:
			if l[i] == 'B' and l[i + 1] == 'G':
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				i += 2
			else:
				i += 1
		except:
			i += 1
s = ''.join(l)
print(s)


(n, k) = [int(x) for x in input().split(' ')]
current = input()

def turn(str):
	temp = list(str)
	for i in range(1, len(str)):
		if str[i] == 'G' and str[i - 1] == 'B':
			temp[i - 1] = 'G'
			temp[i] = 'B'
	ret = ''
	for i in temp:
		ret += i
	return ret
for i in range(k):
	current = turn(current)
print(current)


q = input
(t, rep) = (int(input()[-2:]), q())
for x in '_' * t:
	rep = rep.replace('BG', 'GB')
print(rep)


k = int(input().split(' ')[1])
s = list(input())
while k:
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
	k -= 1
for i in s:
	print(i, end='')


def queue():
	(a, b) = map(int, input().split())
	bg = input()
	output = 0
	for i in range(b):
		bg = bg.replace('BG', 'GB')
	print(bg)
queue()


ab = input()
a = int(ab.split()[0])
b = int(ab.split()[1])
line = input()
for i in range(b):
	x = a
	while x > 1:
		x -= 1
		if line[x] == 'G' and line[x - 1] == 'B':
			line = line[:x - 1] + 'GB' + line[x + 1:]
			x -= 1
print(line)


def arrange(arr, t):
	for j in range(0, t):
		flag = 1
		for i in range(1, len(arr)):
			if arr[i] == 'B':
				flag = 1
			if flag == 1 and arr[i] == 'G' and (arr[i - 1] == 'B'):
				scratch = arr[i]
				arr[i] = arr[i - 1]
				arr[i - 1] = scratch
				flag = 0
	for i in range(0, len(arr)):
		print(arr[i], end='')
nt = list(map(int, input().strip().split()))
p = input()
arr = list(p)
arrange(arr, nt[1])


(n, t) = map(int, input().split())
arr = list(input())
for i in range(t):
	swp = False
	for j in range(n - 1):
		if swp:
			swp = False
			continue
		elif arr[j] == 'B' and arr[j + 1] == 'G':
			arr[j] = 'G'
			arr[j + 1] = 'B'
			swp = True
print(''.join(arr))


n = input().split()
s = input()
l = list(s)
for i in range(int(n[1])):
	j = 0
	while j < int(n[0]) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 1
		j += 1
print(*l, sep='')


def swapElement(c, i, j):
	c = list(c)
	(c[i], c[j]) = (c[j], c[i])
	return ''.join(c)

def main():
	(n, t) = map(int, input().split(' '))
	s = input()
	for _ in range(t):
		latestSwapIndex = -1
		for i in range(0, n - 1):
			if s[i] == 'B' and s[i + 1] == 'G' and (i > latestSwapIndex):
				s = swapElement(s, i, i + 1)
				latestSwapIndex = i + 1
	print(s)
main()


first_line = input().split()
string_len = int(first_line[0])
t = int(first_line[1])
a = input()
a_as_list = list()
a_as_list[:0] = a

def swap(i):
	temp = a_as_list[i]
	a_as_list[i] = a_as_list[i + 1]
	a_as_list[i + 1] = temp
	return
for i in range(t):
	mark_index_list = list()
	for j in range(string_len - 1):
		if a_as_list[j] == 'B' and a_as_list[j + 1] == 'G':
			mark_index_list.append(j)
	for k in mark_index_list:
		swap(k)
print(''.join(a_as_list))


(n, t) = list(map(int, input().split()))
queue = input()
queue_list = []
for stud in queue:
	queue_list.append(stud)

def func(q_list):
	instant = 0
	while instant < t:
		index = 0
		while index <= len(queue) - 2:
			if q_list[index:index + 2] == ['B', 'G']:
				q_list.pop(index)
				q_list.pop(index)
				q_list.insert(index, 'B')
				q_list.insert(index, 'G')
				index += 2
			else:
				index += 1
		instant += 1
	print(''.join(q_list))

def main():
	func(queue_list)
if __name__ == '__main__' and len(queue) == n and (n >= 1) and (t <= 50):
	main()


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
for i in range(t):
	if i == 0:
		x = s.replace('BG', 'GB')
	else:
		y = x
		x = y.replace('BG', 'GB')
print(x)


(n, t) = [int(x) for x in input().split(' ')]
ln = input()
import re
for i in range(t):
	ln = re.sub('BG', 'GB', ln)
print(ln)


inp = str(input())
vals = inp.split(' ')
total = int(vals[0])
times = int(vals[1])
queue = list(str(input()))
n = 0
while n < times:
	m = 0
	while m < total - 1:
		if queue[m] == 'B' and queue[m + 1] == 'G':
			placeholder = queue[m]
			queue[m] = queue[m + 1]
			queue[m + 1] = placeholder
			m += 2
		else:
			m += 1
	n += 1
print(''.join(queue))


(n, m) = map(int, input().split())
a = input()
while m > 0:
	a = a.replace('BG', 'GB')
	m -= 1
print(a)


fLineInput = input()
word = list(input())
changeList = []
(ln, moves) = fLineInput.split()
(ln, moves) = (int(ln), int(moves))
for j in range(0, moves):
	for i in range(0, ln - 1):
		if word[i] == 'B' and word[i + 1] == 'G':
			changeList.append(i)
	for i in changeList:
		word[i] = 'G'
		word[i + 1] = 'B'
	changeList = []
word = ''.join(word)
print(word)


n = list(map(int, input().strip().split()))
s = input()
for j in range(n[1]):
	if 'BG' in s:
		s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
s = list(input())
while t:
	pos = []
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			pos.append(i)
	if len(pos):
		for i in pos:
			(s[i], s[i + 1]) = ('G', 'B')
	else:
		break
	t -= 1
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
l = [x for x in s]
while t > 0:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 1
		i += 1
	i = 0
	t -= 1
print(''.join(l))


import math
sss = input().split()
n = int(sss[0])
t = int(sss[1])
s = input()
while t > 0:
	i = 1
	s1 = s
	while i < n:
		if s[i] == 'G' and s[i - 1] == 'B':
			s1 = s1[:i - 1] + 'GB' + s1[i + 1:]
		i += 1
	s = s1
	t -= 1
print(s1)


s = input().split()
l = input()
for i in range(int(s[1])):
	k = ''
	i = 0
	while i < len(l):
		if i + 1 < len(l) and l[i] == 'B' and (l[i + 1] == 'G'):
			k = k + 'GB'
			i += 2
		else:
			k = k + l[i]
			i += 1
	l = k
print(l)


import sys
from bisect import *
from math import floor, sqrt, ceil, factorial as F, gcd, pi
from itertools import chain, combinations, permutations, accumulate
from collections import Counter, defaultdict, OrderedDict, deque
from array import array
INT_MAX = sys.maxsize
INT_MIN = -sys.maxsize - 1
mod = 1000000007
ch = 'abcdefghijklmnopqrstuvwxyz'
lcm = lambda a, b: a * b // gcd(a, b)
setbit = lambda x: bin(x)[2:].count('1')
input = lambda : sys.stdin.readline()

def solve():
	(n, t) = map(int, sys.stdin.readline().split())
	s = input()
	queue = []
	while t and 'BG' in s:
		s = s.replace('BG', 'GB')
		t -= 1
	print(s)
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
solve()


(n, times) = map(int, input().split())
s = input()
lis = []
d = 0
step = 1
for i in s:
	lis.append(i)
for _ in range(times):
	d = 0
	for i in range(n - 1):
		if d == 1:
			d = 0
			continue
		if lis[i] == 'B' and lis[i + 1] == 'G':
			lis[i + 1] = 'B'
			lis[i] = 'G'
			d = 1
print(''.join(lis))


(n, t) = map(int, input().split(' '))
s = input()
y = []
for i in s:
	y.append(i)
while t > 0:
	i = 1
	while i < n:
		if y[i] == 'G' and y[i - 1] == 'B':
			m = y[i]
			y[i] = y[i - 1]
			y[i - 1] = m
			i = i + 2
		else:
			i = i + 1
	t -= 1
for i in y:
	print(i, end='')


def solve(s, t):
	for __ in range(t):
		i = 1
		while i < len(s):
			if s[i - 1] == 'B' and s[i] == 'G':
				(s[i], s[i - 1]) = (s[i - 1], s[i])
				i += 1
			i += 1
	return ''.join(s)
(n, t) = list(map(int, input().split()))
ss = list(input())
print(solve(ss, t))


(q, t) = map(int, input().split())
n = input()
for p in range(t):
	n = n.replace('BG', 'GB')
print(n)


(child, t) = list(map(int, input().split()))
s = list(input())
for i in range(t):
	c = 1
	while c < child:
		if s[c] == 'G' and s[c - 1] == 'B':
			s[c] = 'B'
			s[c - 1] = 'G'
			c += 1
		c += 1
print(''.join(s))


(n, t) = map(int, input().split())
i = 1
result = str()
queue = list(input())
for j in range(t):
	i = 1
	while i < len(queue):
		if ord(queue[i]) > ord(queue[i - 1]):
			queue[i] = 'B'
			queue[i - 1] = 'G'
			i += 1
		i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
f = list(str(input()))
for i in range(t):
	h = 1
	while h < n:
		if f[h] == 'G' and f[h - 1] == 'B':
			(f[h], f[h - 1]) = (f[h - 1], f[h])
			h += 1
		h += 1
for i in range(n):
	print(f[i], end='')


values = input().split()
(children, times) = (int(values[0]), int(values[1]))
order = list(map(lambda x: x, input()))
for time in range(times):
	child = 0
	while child < children - 1:
		if order[child] == 'B':
			if order[child + 1] == 'G':
				(order[child], order[child + 1]) = ('G', 'B')
				child += 2
			else:
				child += 1
		else:
			child += 1
new_order = ''.join(order)
print(new_order)


(n, t) = list(map(int, input().split()))
data = input()
while t > 0:
	t -= 1
	data = data.replace('BG', 'GB')
print(data)


(n, t) = map(int, input().split())
a = input()
line = list(a)[:]
let = []
while t > 0:
	for i in range(n - 1):
		if line[i] == 'B' and line[i + 1] == 'G':
			let.append(i)
	for i in let:
		line[i] = 'G'
		line[i + 1] = 'B'
	t = t - 1
x = ''.join(line)
print(x)


i = 0
x = []
while i < 2:
	n = input()
	x.append(n)
	i = i + 1
y = x[0].split(' ')[1]
j = 0
while j < int(y):
	k = 0
	while k < len(x[1]) - 1:
		p = x[1][k:k + 2]
		if p == 'BG':
			o = x[1][:k] + 'GB' + x[1][k + 2:]
			del x[1]
			x.append(o)
			k = k + 2
		else:
			k = k + 1
	j = j + 1
print(x[1])


n = list(map(int, input().split()))
s = input()
lis = []
for i in s:
	lis.append(i)
lls = lis
j = 0
for i in range(n[1]):
	while j < n[0] - 1:
		if lis[j] == 'B' and lis[j + 1] == 'G':
			(lls[j], lls[j + 1]) = (lls[j + 1], lls[j])
			j += 1
		j += 1
	j = 0
ssttrr = ''.join(map(str, lls))
print(ssttrr)


(n, t) = input().split(' ')
n = int(n)
t = int(t)
line = list(input().strip())
for i in range(t):
	j = 0
	while j < len(line) - 1:
		if line[j] == 'B' and line[j + 1] == 'G':
			dummy = line[j]
			line[j] = line[j + 1]
			line[j + 1] = dummy
			j += 2
		else:
			j += 1
result = ''
for i in line:
	result += str(i)
print(result)


(q, w) = map(int, input().split())
a = [i for i in input()]
for i in range(0, w):
	j = q - 2
	while j >= 0:
		if (a[j] == 'B') & (a[j + 1] == 'G'):
			a[j] = 'G'
			a[j + 1] = 'B'
			j -= 2
		else:
			j -= 1
for i in a:
	print(i, end='')


(n, t) = map(int, input().split())
si = list(map(str, input()))
ib = []
f = 0
g = 0
for x in si:
	if x == 'B':
		f += 1
	else:
		g += 1
if f == n:
	print(''.join(si))
elif g == n:
	print(''.join(si))
else:

	def f(s):
		global si
		for i in range(len(si)):
			if si[i] == 'B' and i != n - 1:
				ib.append(i)
		for x in ib:
			if x == n - 1:
				break
			else:
				(si[x + 1], si[x]) = (si[x], si[x + 1])
		return si
	while t != 0:
		t -= 1
		ib = []
		si = f(si)
	print(''.join(si))


(n, t) = [int(x) for x in input().split()]
order = input()
for i in range(int(t)):
	pos = 0
	newOrder = ''
	while pos < int(n) - 1:
		if order[pos] == 'B' and order[pos + 1] == 'G':
			newOrder += 'GB'
			pos += 2
		else:
			newOrder += order[pos]
			pos += 1
	newOrder += order[pos:]
	order = newOrder
print(order)


b = []
(n, a) = [int(p) for p in input().split()]
queue = [k for k in input()]
while a > 0:
	a -= 1
	for i in range(n - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			b.append(i)
	for i in b:
		queue[i] = 'G'
		queue[i + 1] = 'B'
print(''.join(queue))


num = input()
order = input()
(n, t) = num.split(' ')
n = int(n)
t = int(t)
order = list(order)
p = []
for k in range(t):
	for i in range(len(order) - 1):
		if order[i] == 'B':
			if i - 1 not in p:
				if order[i + 1] == 'G':
					p.append(i)
					order.pop(i)
					order.insert(i + 1, 'B')
	p.clear()
for j in range(len(order)):
	print(order[j], end='')


a = str(input())
l1 = a.split(' ')
b = str(input())
l2 = []
l2[:] = b
l3 = []
for i in range(int(l1[1])):
	for j in range(int(l1[0]) - 1):
		if l2[j] == 'B':
			if l2[j + 1] == 'G':
				l3.append(j)
			else:
				continue
	for k in range(len(l3)):
		l2[l3[k]] = 'G'
		l2[l3[k] + 1] = 'B'
for i in range(len(l2)):
	print(l2[i], end='')


(n, t) = [int(m) for m in input().split()]
s = input()
while t:
	s = s.replace('BG', 'GB')
	t -= 1
print(s)


[n, t] = [int(i) for i in input().split(' ')]
s = input()
indices = []
str_arr = []
for r in range(len(s)):
	str_arr.append(s[r])
for j in range(len(s) // 2):
	indices.append(-1)
for x in range(t):
	k = 0
	for i in range(len(s) - 1):
		if str_arr[i] == 'B' and str_arr[i + 1] == 'G':
			indices[k] = i
			k += 1
	for k in range(len(indices)):
		if indices[k] != -1:
			temp = str_arr[indices[k]]
			str_arr[indices[k]] = str_arr[indices[k] + 1]
			str_arr[indices[k] + 1] = temp
	for g in range(len(indices)):
		indices[g] = -1
for y in range(len(s)):
	print(str_arr[y], end='')


(n, t) = map(int, input().split())
q = input()
for i in range(t):
	j = 1
	while j < n:
		if q[j - 1] == 'B' and q[j] == 'G':
			if j == 1:
				q = 'GB' + q[2:]
				j += 1
			elif j == n - 1:
				q = q[:-2] + 'GB'
			else:
				q = q[:j - 1] + 'GB' + q[j + 1:]
				j += 1
		j += 1
print(q)


(n, t) = input().split(' ')
a = input()
for tt in range(int(t)):
	i = 0
	b = ''
	while i <= int(n) - 1:
		if i < int(n) - 1:
			if a[i] == 'B' and a[i + 1] == 'G':
				b += 'GB'
				i += 2
			else:
				b += a[i]
				i += 1
		else:
			b += a[i]
			i += 1
	a = b
print(b)


(n, t) = input().split(' ')
t = int(t)
s = input()
a = list(s)
while t > 0:
	i = 0
	j = 1
	t -= 1
	while j < len(s):
		if a[i] == 'B' and a[j] == 'G':
			(a[i], a[j]) = (a[j], a[i])
			i += 1
			j += 1
		i += 1
		j += 1
a = ''.join(a)
print(a)


(n, k) = input().split()
n = int(n)
k = int(k)
a1 = input()
a = []
count = 0
result = 100
q = ''
if 1 <= n <= 50 and 1 <= k <= 50:
	for i in a1:
		if i == 'B' or i == 'G':
			count = count + 1
	if count == n:
		for p in a1:
			a.append(p)
		for i in range(0, k):
			for j in range(0, len(a) - 1):
				if a[j] == 'B' and a[j + 1] == 'G' and (j != result + 1):
					c = a[j]
					a[j] = a[j + 1]
					a[j + 1] = c
					result = j
			result = 100
		for n in a:
			q = q + n
		print(q)


from sys import stdin

def readInts():
	return map(int, stdin.readline().strip().split())

def solve(n, t, vs):
	vs_pre = list(vs)
	for _ in range(t):
		vs_next = []
		ix = 0
		while ix < n:
			if ix == n - 1:
				vs_next.append(vs_pre[ix])
				break
			if vs_pre[ix] == 'B' and vs_pre[ix + 1] == 'G':
				vs_next.append('G')
				vs_next.append('B')
				ix += 2
			else:
				vs_next.append(vs_pre[ix])
				ix += 1
		vs_pre = vs_next
	return ''.join(vs_pre)

def run():
	(n, t) = readInts()
	vs = stdin.readline().strip()
	print(solve(n, t, vs))
run()


n = list(map(int, input().split()))
q = [i for i in input()]
for i in range(n[1]):
	start = 0
	while start < len(q) - 1:
		if q[start] == 'B':
			if q[start + 1] == 'G':
				(q[start], q[start + 1]) = (q[start + 1], q[start])
				start = start + 2
			else:
				start = start + 1
		else:
			start = start + 1
for x in q:
	print(x, end='')


(x, y) = input().split()
z = input()
for j in range(int(y)):
	i = 0
	while i < int(x) - 1:
		if z[i] == 'B' and z[i + 1] == 'G':
			z = z[0:i] + 'G' + 'B' + z[i + 2:]
			if i == int(x) - 2:
				i += 1
			else:
				i += 2
		else:
			i = i + 1
print(z)


(n, k) = [int(x) for x in input().strip().split()]
st = list(input())

def string(string):
	n = len(string)
	i = 0
	while i < n - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			(string[i], string[i + 1]) = ('G', 'B')
			i = i + 2
		else:
			i = i + 1
	return string
for i in range(0, k):
	st = string(st)
print(''.join(st))


line_of_params = input()
line_of_params = line_of_params.split(' ')
list_of_queue = input()
list_of_queue = list(list_of_queue)

def change_place(x, t):
	prev_letter = None
	while t > 0:
		for i in range(x):
			letter = list_of_queue[i]
			if letter == 'G' and prev_letter == 'B':
				list_of_queue[i - 1] = letter
				list_of_queue[i] = prev_letter
				prev_letter = None
				continue
			elif letter == 'B':
				prev_letter = 'B'
				continue
		prev_letter = None
		t -= 1
change_place(int(line_of_params[0]), int(line_of_params[1]))
print(''.join(list_of_queue))


(n, r) = tuple(map(int, input().split()))
s = input()
s = list(s)
for _ in range(r):
	i = -1
	while i < n:
		i = i + 1
		j = i + 1
		if j >= n:
			continue
		if s[j] == 'G' and s[i] == 'B':
			s[j] = 'B'
			s[i] = 'G'
			i = j
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
l = []
a = ''
for i in s:
	l.append(i)
for i in range(t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 1
		j += 1
for i in l:
	a += i
print(a)


(numP, t) = map(int, input().split())
seq = list(input())
for i in range(t):
	j = 0
	while j < numP - 1:
		if seq[j] < seq[j + 1]:
			(seq[j + 1], seq[j]) = (seq[j], seq[j + 1])
			j += 2
		else:
			j += 1
seq = ''.join(seq)
print(seq)


__author__ = 'JohnHook'
(n, t) = list(map(int, input().split()))
str = input()
s = list()
for ch in str:
	s.append(ch)
for i in range(t):
	a = list()
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			a.append(j)
	for j in a:
		(s[j], s[j + 1]) = (s[j + 1], s[j])
print(''.join(s))


def queue_at_the_school():
	(queue_size, steps) = input().split()
	steps = int(steps)
	queue_size = int(queue_size)
	queue = input()
	for i in range(0, steps):
		i = 0
		while i < queue_size - 1:
			if queue[i:i + 2] == 'BG':
				queue = queue[:i] + 'GB' + queue[i + 2:]
				i += 1
			i += 1
	print(queue)
queue_at_the_school()


(Children, time) = input().split()
queue1 = input()
queue = list(queue1)
i = 1
while i <= int(time):
	j = len(queue) - 1
	while j > 0:
		per = 0
		if queue[j] == 'G' and queue[j - 1] == 'B':
			(queue[j], queue[j - 1]) = (queue[j - 1], queue[j])
			''.join(queue)
			per = 1
		if per:
			j -= 2
		else:
			j -= 1
	string = ''.join(queue)
	i += 1
print(string)


from random import randint
from math import *
(n, t) = map(int, input().split())
c = str(input())
r = ''
for i in range(t):
	r = c[:]
	for k in range(n - 1):
		if c[k] == 'B' and c[k + 1] == 'G':
			r = r[:k] + 'GB' + r[k + 2:]
	c = r[:]
print(c)


(n, t) = map(int, input().split())
s = list(input())
for j in range(t):
	z = tuple(s)
	for i in range(n - 1):
		if z[i] == 'B' and z[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
print(''.join(s))


ip = list(map(int, input().split(' ')))
s = list(input())
n = ip[0]
t = ip[1]
for i in range(t):
	j = 0
	swap = False
	while j < n:
		if j < n - 1 and s[j] == 'B' and (s[j + 1] == 'G'):
			temp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = temp
			j += 2
			swap = True
		else:
			j += 1
	if not swap:
		break
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input().upper())
for _ in range(t):
	ans = ''
	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 += 1
		i += 1
print(''.join(s))


entrada = input().split()
string = input()
tiempo = int(entrada[1])

def intercalar(s, t):
	if t == 0:
		return s
	i = 0
	s_aux = ''
	while i < len(s):
		if i != len(s) - 1:
			if s[i + 1] == 'G' and s[i] == 'B':
				s_aux += s[i + 1] + s[i]
				i += 2
			else:
				s_aux += s[i]
				i += 1
		else:
			s_aux += s[i]
			i += 1
	if t > 0:
		return intercalar(s_aux, t - 1)
print(intercalar(string, tiempo))


from sys import stdin, stdout
import math
import random
import time

def sumSquare(a):
	s = 0
	for i in range(len(a)):
		s += a[i] * a[i]
	return s

def C():
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	while True:
		for i in range(n):
			op = False
			for j in range(i + 1, n):
				if a[i] | a[j] > max(a[i], a[j]):
					op = True
					if a[i] > a[j]:
						temp_ai = a[i]
						temp_aj = a[j]
						a[i] = temp_ai | temp_aj
						a[j] = temp_ai & temp_aj
					else:
						temp_ai = a[i]
						temp_aj = a[j]
						a[i] = temp_ai & temp_aj
						a[j] = temp_ai | temp_aj
		if not op:
			break
	print(sumSquare(a))

def main():
	(n, t) = list(map(int, stdin.readline().split()))
	s = input()
	for i in range(t):
		new_s = list(s)
		for j in range(1, n):
			if s[j] == 'G' and s[j - 1] == 'B':
				new_s[j] = 'B'
				new_s[j - 1] = 'G'
		s = ''.join(new_s)
	print(s)
main()


(n, t) = map(int, input().split(' '))
queue = input()
for i in range(t):
	try:
		queue = queue.replace('BG', 'GB')
	except:
		pass
print(queue)


a = [int(x) for x in input().split()]
s = input()
arr = []
for i in range(a[1]):
	s = s.replace('BG', 'GB')
	arr.append(s)
print(arr[-1])


(n, t) = map(int, input().split())
inp = input()
li = []
flag = 1
for i in inp:
	li.append(i)
for i in range(t):
	for j in range(n):
		if j < n - 1 and li[j] == 'B' and (li[j + 1] == 'G') and flag:
			temp = li[j]
			li[j] = li[j + 1]
			li[j + 1] = temp
			flag = 0
		else:
			flag = 1
print(''.join(li))


def stol(s):
	l = []
	for each in s:
		l.append(each)
	return l

def ltos(l):
	s = ''
	for i in range(len(l)):
		s = s + l[i]
	return s

def backward(l, m):
	l1 = l[0:m]
	l2 = l[m + 2:]
	l = l1 + [l[m + 1]] + [l[m]] + l2
	return l

def queue(l):
	l_ = l
	for n in range(len(l) - 1):
		if l[n] == 'B' and l[n + 1] == 'G':
			l_ = backward(l_, n)
	return l_

def qt(l, time):
	for t in range(time):
		l = queue(l)
	return l

def main():
	a = input().split(' ')
	l = stol(input())
	time = int(a[1])
	print(ltos(qt(l, time)))
main()


(n, t) = [int(i) for i in input().split()]
L = input()
for j in range(t):
	L = L.replace('BG', 'GB')
print(L)


n = input()
temp = n.split()
time = int(temp[1])
string = input()
my_list = []
for y in string:
	my_list.append(y)
for i in range(time):
	x = 0
	while x < len(my_list) - 1:
		if my_list[x] == 'B' and my_list[x + 1] == 'G':
			my_list[x] = 'G'
			my_list[x + 1] = 'B'
			x = x + 1
		x += 1
print(''.join(my_list))


(l, t) = input().split(' ')
seq = input()
for i in range(int(t)):
	newSeq = seq.replace('BG', 'GB')
	seq = newSeq
print(seq)


(n, t) = map(int, input().split())
int_sequence = list(input().strip().upper())
(boy, a) = (0, n)
for s in int_sequence:
	if s == 'B':
		boy += 1
while t != 0:
	m = 0
	while m < n - 1:
		if int_sequence[m] == 'B' and int_sequence[m + 1] == 'G':
			s = int_sequence[m + 1]
			int_sequence[m + 1] = 'B'
			int_sequence[m] = s
			m += 1
		m += 1
	t -= 1
sequence = ''
for m in int_sequence:
	sequence += m
print(sequence)


(n, t) = map(int, input().split())
s = input()
li = list(s)
l2 = li.copy()
for i in range(t):
	for j in range(n - 1):
		if li[j] == 'B' and li[j + 1] == 'G':
			(l2[j + 1], l2[j]) = (l2[j], l2[j + 1])
	li = l2.copy()
s = ''.join(l2)
print(s)


import copy
(n, t) = map(int, input().split())
a = list(input())
b = copy.deepcopy(a)
for i in range(t):
	for j in range(len(a) - 1):
		if a[j] == 'B' and a[j + 1] == 'G':
			del b[j + 1]
			b.insert(j, 'G')
	a = copy.deepcopy(b)
print(''.join(b))


line = input()
(n, t) = [int(i) for i in line.split()]
line = input()
queue = list(line)
newqueue = list(line)
while t > 0:
	if n == 1:
		break
	for i in range(n - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(newqueue[i], newqueue[i + 1]) = (newqueue[i + 1], newqueue[i])
	queue = newqueue[:]
	t -= 1
print(''.join(queue))


n = input().split()
l = list(input())
k = int(n[1])
for j in range(k):
	i = 1
	while i < len(l):
		if l[i] == 'G' and l[i - 1] == 'B':
			l[i] = 'B'
			l[i - 1] = 'G'
			i += 2
		else:
			i += 1
print(''.join(l))


__author__ = 'runekri3'
(n, t) = list(map(int, input().split()))
people = list(input())
for _ in range(t):
	boys_to_swap = []
	for (i, person) in enumerate(people):
		if i + 1 == n or person == 'G':
			continue
		if people[i + 1] == 'G':
			boys_to_swap.append(i)
	for boy_to_swap in boys_to_swap:
		people[boy_to_swap] = 'G'
		people[boy_to_swap + 1] = 'B'
print(''.join(people))


inp = input().split()
t = int(inp[1])
string = list(input())
for i in range(t):
	bloc = 0
	while bloc + 1 <= len(string):
		if bloc + 2 <= len(string):
			if string[bloc + 1] == 'G' and string[bloc] == 'B':
				string[bloc] = 'G'
				string[bloc + 1] = 'B'
				if 'B' in string[bloc + 2:]:
					bloc = string.index('B', bloc + 2)
				else:
					bloc += 2
			else:
				bloc += 1
		else:
			bloc = len(string)
print(''.join(string))


n = str(input())
n = n.split(' ')
time = int(n[1])
length = int(n[0])
queue = str(input())
t = 0
while t < time:
	i = 0
	while i < length - 1:
		if queue[i] == 'B' and queue[i + 1] == 'G':
			queue = queue[:i] + 'GB' + queue[i + 2:]
			i = i + 2
		else:
			i = i + 1
	t = t + 1
print(queue)


def swapPositions(list, pos1, pos2):
	(list[pos1], list[pos2]) = (list[pos2], list[pos1])
	return list
l = input().split()
n = int(l[0])
t = int(l[1])
s = input()
s = list(s)
for _ in range(t):
	j = 0
	while j < n - 1:
		if s[j] == 'B' and s[j + 1] == 'G':
			s = swapPositions(s, j, j + 1)
			j += 2
		else:
			j += 1
for i in s:
	print(i, end='')


(n, t) = map(int, input().split())
queueI = input()
queueO = list(queueI)
for sec in range(t):
	i = 0
	while i < n - 1:
		if queueO[i] == 'B' and queueO[i + 1] == 'G':
			queueO[i] = 'G'
			queueO[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(queueO))


inp_1 = input().split(' ')
inp_2 = []
[inp_2.append(i) for i in input()]
ind = 0
for i in range(0, int(inp_1[1])):
	while True:
		try:
			ind = inp_2.index('B', ind)
			if inp_2[ind + 1] == 'G' and ind + 1 <= len(inp_2):
				(inp_2[ind], inp_2[ind + 1]) = (inp_2[ind + 1], inp_2[ind])
				ind += 2
			elif inp_2[ind + 1] == 'B' and ind + 1 <= len(inp_2):
				ind += 1
		except:
			ind = 0
			break
print(''.join(inp_2))


def f(x):
	a = len(x)
	i = 0
	while i < a - 1:
		if x[i] == 'B' and x[i + 1] == 'G':
			x = x[:i] + 'GB' + x[i + 2:]
			i = i + 2
		else:
			i = i + 1
	return x
(n, t) = input().split()
t = int(t)
m = input()
n = 0
while n < t:
	m = f(m)
	n = n + 1
print(m)


def make_new_line(line):
	(new_line, l) = ('', len(line))
	i = 0
	while i < l:
		if line[i] == 'B' and i < l - 1 and (line[i + 1] == 'G'):
			new_line += 'GB'
			i += 2
		else:
			new_line += line[i]
			i += 1
	return new_line

def main():
	(n, t) = map(int, input().split())
	line = input().strip()
	for i in range(t):
		line = make_new_line(line)
	print(line)
main()


(n, t) = [int(item) for item in input().split(' ')]
queue = input()
for s in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


info = input()
children = int(info.split(' ')[0])
intervals = int(info.split(' ')[1])
queue = list(input())
for i in range(intervals):
	count = 0
	while count < children - 1:
		if queue[count] == 'B' and queue[count + 1] == 'G':
			queue[count] = 'G'
			queue[count + 1] = 'B'
			count += 2
		else:
			count += 1
print(''.join(queue))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
s = input()
s = list(s)
for j in range(t):
	e = []
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			e.append(i)
		else:
			pass
	for k in e:
		x = s[k + 1]
		s[k + 1] = s[k]
		s[k] = x
s = ''.join(s)
print(s)


(n, k) = map(int, input().split())
l = list(input())
for i in range(k):
	j = 0
	while j < n - 1:
		if l[j + 1] == 'G' and l[j] == 'B':
			(l[j], l[j + 1]) = ('G', 'B')
			j += 2
			continue
		j += 1
for i in l:
	print(i, end='')


n = [int(i) for i in input().split()]
s = input()
for j in range(n[1]):
	s = s.replace('BG', 'GB')
print(s)


(n, t) = map(int, input().split())
s = list(input())
for i in range(t):
	move = False
	for i in range(n - 1):
		if s[i + 1] == 'G' and s[i] == 'B' and (not move):
			(s[i + 1], s[i]) = (s[i], s[i + 1])
			move = True
		else:
			move = False
print(''.join(s))


import copy

def process(s):
	res = s[:]
	for i in range(1, len(s)):
		if s[i] == 'G' and s[i - 1] == 'B':
			(res[i], res[i - 1]) = (res[i - 1], res[i])
	return res
fl = input().split()
n = int(fl[0])
t = int(fl[1])
s = input().split()[0]
S = []
for i in range(n):
	S.append(s[i])
for i in range(t):
	S = process(S)
ans = ''
for i in range(n):
	ans += S[i]
print(ans)


import math
import sys

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def inp():
	ls = list(map(int, input().split()))
	return ls
(n, t) = map(int, input().split())
s = list(input())
for _ in range(t):
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			temp = s[i]
			s[i] = s[i + 1]
			s[i + 1] = temp
			i += 1
		i += 1
print(''.join(s))


import copy
(n, t) = input().split()
start = list(input())
for x in range(int(t)):
	prev = 0
	curr = 0
	flag = 0
	for x in range(int(n)):
		if flag:
			flag = 0
			prev = start[x]
			continue
		curr = start[x]
		if prev == 'B' and curr == 'G':
			flag = 1
			temp = start[x - 1]
			start[x - 1] = start[x]
			start[x] = temp
		prev = start[x]
print(''.join(start))


(n, t) = [int(z) for z in input().split()]
mys = input()
line = list(mys)
my = line
while t > 0:
	arr = []
	for p in range(len(line) - 1):
		if line[p] == 'B' and line[p + 1] == 'G':
			arr.append(p + 1)
			arr.append(p)
	for i in range(len(arr) - 1):
		(line[arr[i]], line[arr[i + 1]]) = (line[arr[i + 1]], line[arr[i]])
	t -= 1
Str = ''.join(map(str, line))
print(Str)


X = input().split()
num_kids = int(X[0])
time = int(X[1])
del X
line = input()

def swap2elementinStr(Str, index_elm1):
	List = [x for x in Str]
	for i in range(len(List)):
		if i == index_elm1:
			List[i] = 'G'
			List[i + 1] = 'B'
			break
	string = ''.join(List)
	return string
for t in range(time):
	i = 0
	while i < num_kids - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			line = swap2elementinStr(line, i)
			i += 1
		i += 1
print(line)


(n, t) = map(int, input().split())
l = input()
for i in range(n):
	if i < t:
		l = l.replace('BG', 'GB')
	else:
		break
print(l)


(a, t) = map(int, input().split())
queue = input()
l = list(queue)
b = 0
while b < t:
	i = 0
	while i < a - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
	b = b + 1
newqueue = ''.join(l)
print(newqueue)


(n, t) = map(int, input().split())
f = input()
for y in range(t):
	x = 0
	while x < n:
		if x + 1 < n:
			if f[x] == 'B' and f[x + 1] == 'G':
				f = f[:x] + 'GB' + f[x + 2:]
				x += 2
			else:
				x += 1
		else:
			break
print(f)


n = int(input().split()[1])
s = input()

def gsBbs(s, n):
	while n:
		s = s.replace('BG', 'GB')
		n -= 1
	return s
print(gsBbs(s, n))


k = input().split()
n = int(k[0])
t = int(k[1])
st = input()
out = [st]
for i in range(t):
	out.append(out[i].replace('BG', 'GB'))
print(out[t])


(n, t) = map(int, input().split())
s = input()
arr = []
for i in s:
	arr.append(i)
while t > 0:
	t -= 1
	justswap = False
	for i in range(n - 1):
		if justswap == False:
			if arr[i] == 'B' and arr[i + 1] == 'G':
				arr[i] = 'G'
				arr[i + 1] = 'B'
				justswap = True
		else:
			justswap = False
res = ''.join(arr)
print(res)


def queue_girl(n, t, s):
	if n == 1:
		return s
	r = 0
	s = ' '.join(s).split()
	for i in range(t):
		r = 0
		while r <= n - 2:
			if s[r] < s[r + 1]:
				(s[r + 1], s[r]) = (s[r], s[r + 1])
				r += 1
			r += 1
	return ''.join(s)

def main():
	(n, t) = list(map(int, input().split()))
	s = input()
	print(queue_girl(n, t, s))
main()


try:
	t = int(input()[2:])
	s = input()
	while t:
		s = s.replace('BG', 'GB')
		t -= 1
	print(s)
except:
	pass


(N, T) = map(int, input().split())
P = input()
arr = list(P)
for t in range(T):
	n = 0
	while n < len(arr) - 1:
		if arr[n] == 'B' and arr[n + 1] == 'G':
			(arr[n], arr[n + 1]) = (arr[n + 1], arr[n])
			n += 2
		else:
			n += 1
print(''.join(arr))


(n, t) = [int(x) for x in input().split()]
lst = input()
c = '0'
j = 0
l = list(lst)
while t > 0:
	i = 0
	while i < n - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			c = l[i + 1]
			l[i + 1] = l[i]
			l[i] = c
			i = i + 2
		else:
			i = i + 1
	t -= 1
for s in l:
	print(s, end='')


t = int(input('').split(' ')[1])
q = input('')
for i in range(t):
	if 'BG' in q:
		q = q.replace('BG', 'GB')
	else:
		break
print(q)


import sys
import math
from collections import defaultdict
(n, t) = map(int, input().split())
s = list(input())
s1 = ''
for j in range(t):
	i = 0
	while i < n - 1:
		if s[i] < s[i + 1]:
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 2
		else:
			i += 1
print(s1.join(s))


u = int(input()[2:])
v = input()
while u:
	v = v.replace('BG', 'GB')
	u -= 1
print(v)


(n, t) = map(int, input().split())
lst = list(input())

def swap(lst, i, j):
	temp = lst[i]
	lst[i] = lst[j]
	lst[j] = temp
	return lst
temp_lst = lst.copy()
for j in range(t):
	for i in range(n):
		if lst[i] == 'B' and i != n - 1 and (lst[i + 1] == 'G'):
			temp_lst = swap(temp_lst, i, i + 1)
	lst = temp_lst.copy()
s = ''.join(lst)
print(s)


(N, t) = [int(x) for x in input().split()]
inp = input()
for i in range(t):
	inp = inp.replace('BG', 'GB')
print(inp)


(n, t) = map(int, input().split())
l = input()
line = [c for c in l]
swapped = False
for _ in range(t):
	swapped = False
	for i in range(n - 1):
		if swapped:
			swapped = False
			continue
		if not swapped and line[i] == 'B' and (line[i + 1] == 'G'):
			line[i] = 'G'
			line[i + 1] = 'B'
			swapped = True
print(''.join(line))


t = int(input()[2:])
q = input()
while t:
	q = q.replace('BG', 'GB')
	t -= 1
print(q)


n = [int(i) for i in input().split()]
line1 = input()
line = []
for i in range(n[0]):
	line.append(line1[i])
for k in range(n[1]):
	i = 0
	while i < len(line) - 1:
		if line[i] == 'B' and line[i + 1] == 'G':
			(line[i], line[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
print(''.join(line))


def find(arr, st, stp):
	try:
		k = arr.index('B', st, stp)
		if arr[k + 1] == 'G':
			(arr[k], arr[k + 1]) = (arr[k + 1], arr[k])
			st = k + 2
		else:
			st += 1
		return find(arr, st, stp)
	except ValueError:
		return arr
(n, t) = map(int, input().split())
a = list(input())
start = 0
stop = n - 1
for i in range(t):
	find(a, start, stop)
output = ''
print(output.join(a))


(a, b) = map(int, input().rstrip().split())
s = list(input())
while b > 0:
	b -= 1
	i = 0
	j = 1
	while j < a:
		if s[i] == 'B' and s[j] == 'G':
			s[i] = 'G'
			s[j] = 'B'
			i = j
			j += 1
		i = j
		j += 1
	i = 0
	j = 1
for i in s:
	print(i, end='')


(n, t) = [int(k) for k in input().split()]
s = input()
sl = list(s)
for T in range(t):
	Z = list()
	for i in range(len(sl) - 1):
		if sl[i] == 'B' and sl[i + 1] == 'G':
			Z.append(i)
	for j in range(len(Z)):
		A = sl[Z[j]]
		b = sl[Z[j] + 1]
		sl[Z[j]] = b
		sl[Z[j] + 1] = A
a = ''.join(sl)
print(a)


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict

def VI():
	return list(map(int, input().split()))

def main(n, t, s):
	for i in range(t):
		change = False
		new = s[:]
		for j in range(n - 1):
			if s[j] == 'B' and s[j + 1] == 'G':
				new[j] = s[j + 1]
				new[j + 1] = s[j]
				change = True
		if change:
			s = new[:]
	print(''.join(new))

def main_input(info=0):
	(n, t) = VI()
	s = list(input())
	main(n, t, s)
main_input()


(num, t1) = input().split()
t = int(t1)
array = list(input())
while t > 0:
	i = 0
	while i < len(array) - 1:
		if array[i] == 'B' and array[i + 1] == 'G':
			(array[i], array[i + 1]) = (array[i + 1], array[i])
			i += 1
		i += 1
	t -= 1
stringOut = ''
for j in range(len(array)):
	stringOut += array[j]
print(stringOut)


(n, m) = map(int, input().split())
a = input()
a = list(a)
for i in range(0, m):
	d = 0
	j = 0
	while j < len(a) - 1:
		if a[j] == 'B' and a[j + 1] == 'G':
			a[j + 1] = 'B'
			a[j] = 'G'
			j += 2
			d = 1
		else:
			j += 1
	if d == 0:
		break
for i in range(0, len(a)):
	print(a[i], end='')
print()


(n, t) = map(int, input().split())
pos = list(input())
s = 0
for _ in range(t):
	i = 0
	while i < n - 1:
		if pos[i] == 'B' and pos[i + 1] == 'G':
			pos[i] = 'G'
			pos[i + 1] = 'B'
			i += 1
			s += 1
		i += 1
	if s == 0:
		break
ans = ''
for i in pos:
	ans += i
print(ans)


arg1 = input().strip().split()
seq = input().strip().split()[0]
a = [seq[j] for j in range(int(arg1[0]))]
b = [seq[j] for j in range(int(arg1[0]))]
for i in range(int(arg1[1])):
	for j in range(1, int(arg1[0])):
		if a[j] == 'G' and a[j - 1] == 'B':
			b[j] = 'B'
			b[j - 1] = 'G'
	a[:] = b[:]
print(''.join(a))


import sys
user = input()
parameters = user.split(' ')
string = input()
list = []
for i in range(len(string)):
	list.append(string[i])
for i in range(int(parameters[1])):
	j = 0
	while j < int(parameters[0]):
		if j < len(string) - 1 and (list[j] == 'B' and list[j + 1] == 'G'):
			(list[j], list[j + 1]) = (list[j + 1], list[j])
			j += 1
		j += 1
for i in range(int(parameters[0])):
	sys.stdout.write(list[i])


n = input().split()
sa = input()
t = int(n[1])
baru = []
for i in range(len(sa)):
	baru += sa[i]
while t > 0:
	i = 0
	while i < len(sa) - 1:
		if sa[i] == 'B' and sa[i + 1] == 'G':
			temp = baru[i + 1]
			baru[i + 1] = baru[i]
			baru[i] = temp
			i += 2
		else:
			i += 1
	t -= 1
	sa = baru
for i in range(len(baru)):
	print(baru[i], end='')


(n, m) = map(int, input().split())
st = input()
for i in range(m):
	flg = False
	g = 0
	for j in range(len(st) - 1):
		if st[j] == 'B' and st[j + 1] == 'G' and (not flg):
			st = st[:j] + 'GB' + st[j + 2:]
			flg = True
			g = j
		if flg and j != g:
			flg = False
print(st)


(n, t) = map(int, input().split())
q = list(input())

def process(q):
	q2 = q[:]
	for i in range(1, n):
		if q[i] == 'G' and q[i - 1] == 'B':
			(q2[i], q2[i - 1]) = (q2[i - 1], q[i])
	return q2
for _ in range(t):
	q = process(q)
print(''.join(q))


(n, t) = [int(x) for x in input().split()]
children = list(input(''))
ln = len(children)
children_list = list(children)
i = ln - 2
while t > 0:
	while i >= 0:
		if children[i] < children[i + 1]:
			temp = children[i + 1]
			children_list[i + 1] = children_list[i]
			children_list[i] = temp
		i = i - 1
	i = ln - 2
	t = t - 1
	f_output = ''
	for char in children_list:
		f_output = f_output + char
	children = f_output
print(f_output)


(n, t) = map(int, input().split())
s = [i for i in input()]
for x in range(t):
	p = [True] * n
	for i in range(n - 2, -1, -1):
		if s[i] == 'B' and s[i + 1] == 'G' and p[i + 1]:
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			p[i] = False
print(''.join(s))


from sys import stdin

def main():
	x = [int(i) for i in stdin.readline().strip().split()]
	y = list(stdin.readline().strip())
	if x[0] == 1:
		print(''.join(y))
	else:
		while x[1] != 0:
			temp = []
			for i in range(x[0] - 1):
				if y[i] == 'B' and y[i + 1] == 'G':
					temp.append(y[i + 1])
					temp.append(y[i])
					(y[i], y[i + 1]) = ('', '')
				elif y[i] != '':
					temp.append(y[i])
					y[i] = ''
				if i == x[0] - 2:
					if y[x[0] - 1] != '':
						temp.append(y[i + 1])
			x[1] -= 1
			y = temp
		print(''.join(y))
main()


line1 = []
line1 = input().split(' ')
n = int(line1[0])
t = int(line1[1])
line2 = input()
for i in range(0, t):
	res = []
	j = 0
	while j < n - 1:
		if line2[j] == 'B' and line2[j + 1] == 'G':
			res.append(line2[j + 1])
			res.append(line2[j])
			j += 2
		else:
			res.append(line2[j])
			j += 1
	if j == n - 1:
		res.append(line2[j])
	line2 = ''.join(res)
print(line2)


def bfs(order, stop_time):
	order = list(order)
	q = []
	n = len(order)
	for i in range(n - 1):
		if order[i] == 'B' and order[i + 1] == 'G':
			q.append(i)
	cur_child = len(q)
	next_child = 0
	time_stamp = 1
	while q:
		cur_index = q.pop(0)
		(order[cur_index], order[cur_index + 1]) = (order[cur_index + 1], order[cur_index])
		cur_child -= 1
		if cur_index + 2 <= n - 1 and order[cur_index + 2] == 'G':
			q.append(cur_index + 1)
			next_child += 1
		if cur_index - 1 >= 0 and order[cur_index - 1] == 'B':
			q.append(cur_index - 1)
			next_child += 1
		if cur_child == 0:
			cur_child = next_child
			next_child = 0
			if time_stamp == stop_time:
				break
			time_stamp += 1
	return ''.join(order)
(num_people, stop_time) = input().split()
order = input()
print(bfs(order, int(stop_time)))


(n, q) = map(int, input().split(' '))
(n, q) = (int(n), int(q))
s = str(input())
list1 = []
for letter in s:
	list1.append(letter)
l = len(list1)
j = 1
while j <= q:
	k = 0
	while k < l - 1:
		if list1[k] == 'B' and list1[k + 1] == 'G':
			list1[k] = 'G'
			list1[k + 1] = 'B'
			k += 2
		else:
			k += 1
	j += 1
s1 = ''
for i in range(l):
	s1 = s1 + str(list1[i])
print(s1)


(n, t) = map(int, input().split())
a = list(input())
for i in range(t):
	i = 0
	try:
		while i < len(a):
			if a[i] == 'B' and a[i + 1] == 'G':
				(a[i], a[i + 1]) = (a[i + 1], a[i])
				i += 1
			i += 1
	except:
		pass
for x in a:
	print(x, end='')


(n, t) = [int(x) for x in input().split()]
word = input()
for j in range(t):
	word = word.replace('BG', 'GB')
print(word)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	sz = s[0]
	for j in range(1, len(s)):
		if s[j - 1] == 'B' and s[j] == 'G':
			sz = sz[:len(sz) - 1] + 'GB'
		else:
			sz += s[j]
	s = sz
print(s)


(n, t) = list(map(int, input().split()))
i = 1
queue = list(input())
while i <= t:
	queueq = queue.copy()
	latter_queue = queueq.copy()
	del latter_queue[0]
	k = 0
	for (a, b) in zip(queueq, latter_queue):
		if a == 'B' and b == 'G':
			queue[k] = 'G'
			queue[k + 1] = 'B'
		k += 1
	i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
l = list(input())

def compute(l, n):
	i = 0
	while i < n:
		if i >= n - 1:
			break
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 2
		else:
			i += 1
	return l
for i in range(t):
	l = compute(l, n)
print(''.join(l))


(n, t) = [int(i) for i in input().split(' ')]
string = input()
for _ in range(t):
	string = string.replace('BG', 'GB')
print(string)


from sys import stdin, stdout

def solve(q, n, t):
	if n == 1:
		return q
	if n == 2:
		if q == 'BG':
			return 'GB'
		return q
	res = q
	while t > 0:
		t -= 1
		aux = ''
		i = 0
		while i < n:
			if i + 1 < n and res[i] == 'B' and (res[i + 1] == 'G'):
				aux += 'GB'
				i += 2
			else:
				aux += res[i]
				i += 1
		res = aux
	return res
(n, t) = list(map(int, stdin.readline().strip().split()))
queue = str(stdin.readline().strip())
print(solve(queue, n, t))


(n, t) = input().split()
n = int(n)
t = int(t)
string = list(input())
for i in range(t):
	j = 1
	while j < n:
		if string[j - 1] == 'B' and string[j] == 'G':
			string[j] = 'B'
			string[j - 1] = 'G'
			j += 1
		j += 1
for i in string:
	print(i, end='')


(n, t) = map(int, input().split())
s = input()
s.replace('BG', 'GB')
ans = [s.replace('BG', 'GB')]
for i in range(t - 1):
	if 'BG' not in ans[-1]:
		continue
	ans.append(ans[-1].replace('BG', 'GB'))
print(ans[-1])


def main():
	(n, t) = [int(i) for i in input().split()]
	inn = input()
	seq = [char for char in inn]
	while t:
		i = 0
		while i < n:
			if i < n - 1:
				if seq[i] == 'B' and seq[i + 1] == 'G':
					(seq[i], seq[i + 1]) = (seq[i + 1], seq[i])
					i += 1
			i += 1
		t -= 1
	s = ''
	for i in seq:
		s += i
	print(s)
	return 0
main()


(n, t) = map(int, input().split())
a = str(input())
for x in range(t):
	i = 0
	l = []
	while i < n:
		if i == n - 1 and a[n - 1] == 'B':
			l.insert(i, a[i])
			break
		elif a[i] == 'B' and a[i + 1] == 'G':
			l.insert(i, a[i + 1])
			l.insert(i + 1, a[i])
			i = i + 2
		else:
			l.insert(i, a[i])
			i = i + 1
	a = ''.join(l)
print(a)


(N, t) = list(map(int, input().split()))
queue = input()[::-1]
for _ in range(t):
	i = 0
	while i < len(queue) - 1:
		if queue[i] == 'G' and queue[i + 1] == 'B':
			queue = queue[:i] + 'BG' + queue[i + 2:]
			i += 2
		else:
			i += 1
print(queue[::-1])


import copy
(n, t) = [int(s) for s in input().split()]
s = list(input())
s_ans = []
for ele in s:
	s_ans.append(ele)
for j in range(t):
	for i in range(1, n):
		if s[i] == 'G' and s[i - 1] == 'B':
			temp = s_ans[i]
			s_ans[i] = s_ans[i - 1]
			s_ans[i - 1] = temp
	s = s_ans.copy()
print(''.join(s_ans))


t = int(input().split()[1])
que = input()
que_list = [que[i] for i in range(len(que))]
for i in range(t):
	j = 0
	while j < len(que) - 1:
		if que_list[j] == 'B' and que_list[j + 1] == 'G':
			que_list[j] = 'G'
			que_list[j + 1] = 'B'
			j += 2
		else:
			j += 1
for i in range(len(que_list)):
	print(que_list[i], end='')
print()


(r, t) = map(int, input().split())
s = list(input().strip())
for i in range(t):
	x = []
	for j in range(r - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			x.append(j)
	for k in range(len(x)):
		s[x[k]] = 'G'
		s[x[k] + 1] = 'B'
print(''.join(s))


inp = input().split()
n = int(inp[0])
t = int(inp[1])
q = list(input())

def finding(qlis):
	fls = []
	for items in range(0, len(qlis)):
		if qlis[items] == 'G':
			fls.append(items)
	return fls

def step(q, q2, ls):
	ls = finding(q)
	for items in ls:
		if items != 0:
			if q[items - 1] == 'B':
				q2[items - 1] = 'G'
				q2[items] = 'B'
	return q2
for tc in range(0, t):
	q2 = []
	for items in q:
		q2.append(items)
	ls = finding(q)
	q2 = step(q, q2, ls)
	q = q2
s = ''
for items in q2:
	s += items
print(s)


(length, times) = map(int, input().split(' '))
s = list(input())
k = True
if 'G' not in s or 'B' not in s:
	k = False
t = True
if k:
	for i in range(times):
		for i in range(len(s) - 1, 0, -1):
			if s[i] == 'G' and s[i - 1] == 'B' and t:
				del s[i]
				s.insert(i - 1, 'G')
				t = False
			else:
				t = True
print(''.join(s))


(n, seconds) = map(int, input().split(' '))
q = list(input())
for s in range(seconds):
	i = 0
	while i < len(q) - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(q))


n = list(map(int, input().split()))
queue_len = n[0]
time = n[1]
list1 = input()

def transform(list1):
	for t in range(n[1]):
		str1 = ''
		i = 0
		while i < len(list1):
			if i != len(list1) - 1 and (list1[i] == 'B' and list1[i + 1] == 'G'):
				str1 = str1 + list1[i + 1] + list1[i]
				i += 2
			else:
				str1 = str1 + list1[i]
				i += 1
		list1 = str1
	return str1
print(transform(list1))


(n, t) = input().split()
a = input()
t = int(t)
d = []
for i in a:
	d.append(i)
for j in range(t):
	h = 0
	while h < len(d) - 1:
		if d[h] == 'B' and d[h + 1] == 'G':
			d[h] = 'G'
			d[h + 1] = 'B'
			h += 2
		else:
			h += 1
ans = ''
for m in d:
	ans += m
print(ans)


(n, t) = list(map(int, input('').split(' ')))
s = input('')
list1 = [i for i in s]
for i in range(t):
	list2 = []
	for i in range(0, n - 1):
		if list1[i] == 'B' and list1[i + 1] == 'G':
			list2.append(i)
	for i in range(len(list2)):
		(list1[list2[i]], list1[list2[i] + 1]) = (list1[list2[i] + 1], list1[list2[i]])
for i in list1:
	print(i, end='')


k = list(map(int, input().split()))
q = list(input())
for j in range(k[1]):
	i = 0
	while i < len(q):
		if q[i] == 'B' and i != k[0] - 1:
			if q[i + 1] == 'G':
				(q[i], q[i + 1]) = (q[i + 1], q[i])
				i += 1
		i += 1
print(''.join(q))


(n, k) = [int(x) for x in input().split(' ')]
str = list(input())
while k > 0:
	i = 0
	while i < n - 1:
		if str[i] == 'B' and str[i + 1] == 'G':
			str[i] = 'G'
			str[i + 1] = 'B'
			i += 2
		else:
			i += 1
	k -= 1
print(''.join(str))


(n, t) = map(int, input().split())
c_l = list(input())
for count in range(t):
	p = 0
	while p < n - 1:
		if c_l[p] == 'B' and c_l[p + 1] == 'G':
			(c_l[p], c_l[p + 1]) = (c_l[p + 1], c_l[p])
			p += 1
		p += 1
print(''.join(c_l))


(n, t) = map(int, input().split())
sl = [i for i in input()]
while t > 0:
	i = 0
	while i < n - 1:
		if sl[i] == 'B' and sl[i + 1] == 'G':
			(sl[i], sl[i + 1]) = ('G', 'B')
			i += 2
		else:
			i += 1
	t -= 1
print(''.join(sl))


def school(n, t, s):
	s = list(s)
	for i in range(t):
		count = 0
		while count < n - 1:
			if s[count] == 'B' and s[count + 1] == 'G':
				(s[count], s[count + 1]) = ('G', 'B')
				count += 2
			else:
				count += 1
	return ''.join(s)
(N, T) = [int(i) for i in input().split()]
st = input()
print(school(N, T, st))


inp = input()
c = inp.split()
inp1 = input()
l = list()
for i in inp1:
	l.append(i)
k = c[1]
k = int(k)
for j in range(k):
	i = 1
	while i < len(l):
		if l[i] == 'G' and l[i - 1] == 'B':
			l[i] = 'B'
			l[i - 1] = 'G'
			i = i + 2
		else:
			i = i + 1
s = ''.join(l)
print(s)


(a, b) = input().split()
row = list(map(str, input()))
for i in range(int(b)):
	count = 1
	while count < int(a):
		if row[count] == 'B':
			count = count + 1
			continue
		if row[count] == 'G':
			(row[count - 1], row[count]) = (row[count], row[count - 1])
			count = count + 2
print(''.join(row))


(n, b) = map(int, input().split())
xx = input()
x = [i for i in xx]
l = -1
c = 0
while c < b:
	i = 1
	while i < n:
		if x[i] == 'G' and x[i - 1] == 'B':
			x[i] = 'B'
			x[i - 1] = 'G'
			i += 1
		i += 1
	c += 1
print(*x, sep='')


import sys
(n, t) = map(int, sys.stdin.readline().split())
queue = [gender for gender in sys.stdin.readline()]
for i in range(t):
	new_queue = queue.copy()
	for j in range(n - 1):
		if queue[j] == 'B':
			if queue[j + 1] == 'G':
				(new_queue[j], new_queue[j + 1]) = (new_queue[j + 1], new_queue[j])
	queue = new_queue
sys.stdout.write(''.join(queue))


(n, t) = map(int, input().split())
status = [c for c in input()]
for _ in range(t):
	i = 0
	while i < n - 1:
		if status[i] == 'B' and status[i + 1] == 'G':
			(status[i], status[i + 1]) = (status[i + 1], status[i])
			i += 1
		i += 1
print(''.join(status))


(n, t) = map(int, input().split(' '))
q = list(input())

def swap(queue, i):
	j = i + 1
	temp = queue[i]
	queue[i] = queue[j]
	queue[j] = temp

def one_sec_change(que):
	changed = False
	i = 0
	while i < len(que) - 1:
		if que[i] == 'B' and que[i + 1] == 'G':
			swap(que, i)
			changed = True
			i += 1
		i += 1
	return changed
for _ in range(t):
	if not one_sec_change(q):
		break
print(''.join(q))


(i, j) = map(int, input().split())
x = input()
while j:
	x = x.replace('BG', 'GB')
	j -= 1
print(x)


def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def flip(S):
	prev_flip = False
	for i in range(1, len(S)):
		if S[i] == 'G' and S[i - 1] == 'B' and (not prev_flip):
			prev_flip = True
			(S[i - 1], S[i]) = (S[i], S[i - 1])
		else:
			prev_flip = False
	return S

def solve():
	(N, T) = getInts()
	S = listStr()
	while T:
		S = flip(S)
		T -= 1
	return ''.join(S)
ans = solve()
print(ans)


def checkPos(pos):
	global q, m
	if pos == n - 1:
		return
	if q[pos] == 'B' and q[pos + 1] == 'G':
		q[pos] = 'G'
		q[pos + 1] = 'B'
		m = True
(n, t) = input().split()
(n, t) = (int(n), int(t))
q = list(input())
m = False
for i in range(t):
	for j in range(n):
		if m == True:
			m = False
			continue
		checkPos(j)
print(''.join(q))


(n, t) = map(int, input().split())
a = list(input())
for i in range(0, t):
	b = list()
	b.append(a[0])
	for i in range(1, len(a)):
		if a[i] == 'G' and a[i - 1] == 'B':
			b[i - 1] = 'G'
			b.append('B')
		else:
			b.append(a[i])
	a = b
a = ''.join(a)
print(a)


from sys import stdin
(a, b) = [int(i) for i in stdin.readline().strip().split()]
nios = list(stdin.readline().strip())
for x in range(b):
	k = 0
	vacia = []
	while k < a - 1:
		if nios[k] == 'B' and nios[k + 1] == 'G':
			vacia.append('G')
			vacia.append('B')
			k += 2
		else:
			vacia.append(nios[k])
			k += 1
	if len(vacia) < a:
		vacia.append(nios[-1])
	nios = vacia
print(''.join(nios))


(n_children, t_sec) = [int(x) for x in input().split()]
arrangement = [x for x in input()]

def swap(i1, lis):
	(lis[i1], lis[i1 + 1]) = (lis[i1 + 1], lis[i1])

def find_and_swap(lis):
	swapped = False
	for i in range(len(lis) - 1):
		if swapped:
			swapped = False
			continue
		if lis[i] + lis[i + 1] == 'BG':
			swap(i, lis)
			swapped = True
for i in range(t_sec):
	find_and_swap(arrangement)
print(''.join(arrangement))


(x, y) = map(int, input().split())
a = str(input())
for i in range(y):
	a = a.replace('BG', 'GB')
print(a)


(n, t) = input().split()
s = input()
res = ''
for i in range(int(t)):
	if 'BG' in s:
		s = s.replace('BG', 'GB')
print(s)


(n, t) = input().split()
(n, t) = (int(n), int(t))
s = list(input())
x = s.copy()
if s.count('B') == 0:
	print(''.join(s))
elif s.count('G') == 0:
	print(''.join(s))
else:
	for k in range(t):
		j = s.index('B')
		for i in range(s.count('B')):
			if j != len(s) - 1:
				if s[j + 1] == 'G':
					x[j] = 'G'
					x[j + 1] = 'B'
			try:
				j = s.index('B', j + 1, len(s))
			except:
				pass
		s = x.copy()
	print(''.join(s))


(n, k) = [int(x) for x in input().split()]
stack = [0 if x == 'B' else 1 for x in input()]
for i in range(k):
	j = 1
	while j < n:
		if stack[j] == 1 and stack[j - 1] == 0:
			stack[j - 1] = 1
			stack[j] = 0
			j += 1
		j += 1
j = 0
while j < n:
	print('B', end='') if stack[j] == 0 else print('G', end='')
	j += 1


T = input().split()
t = int(T[1])
s = input()
f = ''
for i in range(t):
	k = s.split('BG')
	f = 'GB'.join(k)
	s = f
print(f)


inputs = input().split()
total = int(inputs[0])
second = int(inputs[1])
queue = input()
for i in range(second):
	queue = queue.replace('BG', 'GB')
print(queue)


t = int(input()[2:])
pos = input()
while t:
	pos = pos.replace('BG', 'GB')
	t -= 1
print(pos)


(n, t) = map(int, input().split())
s = list(input())
length = len(s)
l = []
for i in range(length - 1):
	if s[i] == 'B':
		l.append(i)
len1 = len(l)
for __ in range(t):
	for i in range(len1):
		if l[i] >= length - 1:
			continue
		elif s[l[i] + 1] == 'G':
			v = s.pop(l[i])
			s.insert(l[i] + 1, v)
			v = l.pop(i)
			l.insert(i, v + 1)
print(''.join(s))


(n, t) = map(int, input().split())
s = list(input())
l = []
for i in range(len(s) - 1):
	if s[i] == 'B':
		l.append(i)
for j in range(t):
	for i in range(len(l)):
		if s[l[i] + 1] == 'G':
			(s[l[i]], s[l[i] + 1]) = (s[l[i] + 1], s[l[i]])
			l[i] = l[i] + 1
			if l[i] == len(s) - 1:
				l.remove(l[i])
print(''.join(s))


from sys import stdin
import copy

def posiciones(c, t):
	while t > 0:
		a = copy.copy(c)
		for i in range(len(c) - 1):
			if c[i] == 'B' and c[i + 1] == 'G':
				a[i] = 'G'
				a[i + 1] = 'B'
		c = copy.copy(a)
		t -= 1
	return a

def main():
	Input = list(map(int, stdin.readline().strip().split()))
	cant_ninos = Input[0]
	tiempo = Input[1]
	cadena = list(map(str, stdin.readline().strip()))
	if cant_ninos != len(cadena):
		return
	r = posiciones(cadena, tiempo)
	for i in r:
		print(i, end='')
main()


(n, t) = map(int, input().split())
queue = [*input()]
for j in range(1, t + 1):
	i = 0
	while i < n - 1:
		if queue[i] + queue[i + 1] == 'BG':
			queue[i] = 'G'
			queue[i + 1] = 'B'
			i += 2
		else:
			i += 1
		if i > n:
			break
print(*queue, sep='')


ints = []
for i in input().split(' '):
	ints.append(int(i))
n = ints[0]
t = ints[1]
s = input()
boyIndices = []
girlIndices = []
for i in range(len(s)):
	if s[i] == 'B':
		boyIndices.append(i)
	elif s[i] == 'G':
		girlIndices.append(i)
for i in range(t):
	for b in range(len(boyIndices)):
		if boyIndices[b] < len(s) - 1:
			if boyIndices[b] + 1 in girlIndices:
				girlIndices[girlIndices.index(boyIndices[b] + 1)] -= 1
				boyIndices[b] += 1
ans = ''
for i in range(len(s)):
	if i in boyIndices:
		ans += 'B'
	else:
		ans += 'G'
print(ans)


temp = ''
nt = input().split()
n = int(nt[0])
t = int(nt[1])
temp = 0
q = list(input())
qtemp = []
qtemp[:] = q[:]
result = ''
for i in range(1, t + 1):
	for c in range(len(qtemp) - 1):
		if q[c] == 'B' and q[c + 1] == 'G':
			temp = qtemp[c]
			qtemp[c] = qtemp[c + 1]
			qtemp[c + 1] = temp
	q[:] = qtemp[:]
for i in q:
	result += i
print(result)


x = input()
x = x.split()
number1 = int(x[0])
number2 = int(x[1])
string = list(input())
temp = ''
output = ''
i = 0
t = 0
while t < number2:
	i = 0
	while i < number1 - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			temp = string[i]
			string[i] = string[i + 1]
			string[i + 1] = temp
			i = i + 2
		else:
			i = i + 1
	number2 -= 1
print(''.join(string))


Girl = True
Boy = False

def move_queue(queue):
	was_boy = False
	for i in range(len(queue)):
		if queue[i] == Girl:
			if was_boy:
				queue[i - 1] = Girl
				queue[i] = Boy
			was_boy = False
		else:
			was_boy = True

def decode(c):
	return ord(c) == ord('G')

def encode(code):
	return 'G' if code else 'B'
(n, t) = map(int, input().strip().split())
s = input()
queue = [decode(s[i]) for i in range(n)]
for _ in range(t):
	move_queue(queue)
print(''.join(map(encode, queue)))


(n, t) = map(int, input().split())
str1 = input()
for time in range(0, t):
	str1 = str1.replace('BG', 'GB')
print(str1)


def arrange(queue, size):
	order = queue
	for i in range(0, size - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			order = order[:i] + 'GB' + queue[i + 2:]
	return order
sn = input().split(' ')
queue = input()
size = int(sn[0])
n = int(sn[1])
for i in range(0, n):
	queue = arrange(queue, size)
print(queue)


def main():
	(n, t) = [int(x) for x in input().split()]
	word = input()
	arr = [letter for letter in word]
	for i in range(t):
		j = 0
		while j < n - 1:
			if (arr[j] == 'B') & (arr[j + 1] == 'G'):
				(arr[j], arr[j + 1]) = (arr[j + 1], arr[j])
				j += 1
			j += 1
	print(''.join(arr))
	return
main()


NO = input()
s = input()
L = NO.split()
n = s
for i in range(int(L[1])):
	n = n.replace('BG', 'GB')
print(n)


f_input = input().split(' ')
s_input = input().upper()
ss_input = []
ss_output = []
answer = ''
stepval = 1
number = int(f_input[0])
seconds = int(f_input[1])
for i in s_input:
	ss_input.append(i)
	ss_output.append(i)
while seconds > 0:
	for i in range(0, number - 1):
		if ss_input[i] == 'B' and ss_input[i + 1] == 'G':
			ss_output[i + 1] = 'B'
			ss_output[i] = 'G'
	seconds -= 1
	ss_input = []
	for i in ss_output:
		ss_input.append(i)
for i in ss_output:
	answer += i
print(answer)


t = input().split()
a = int(t[1])
s = input()
l = []
for i in range(0, len(s)):
	l.append(s[i])
while a != 0:
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i += 1
		i += 1
	a -= 1
new_str = ''
new_str += new_str.join(l)
print(new_str)


(n, t) = [int(x) for x in input().split()]
s = list(input())
for tt in range(t):
	f = False
	for i in range(n - 1):
		if f:
			f = False
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			f = True
print(''.join(s))


(ql, sec) = map(int, input().split())
que = list(input())
db = []
while sec > 0:
	for i in range(len(que) - 1):
		if que[i] == 'B' and que[i + 1] == 'G':
			db.append(i)
	for i in range(len(db)):
		temp = que[db[i]]
		que[db[i]] = que[db[i] + 1]
		que[db[i] + 1] = temp
	db = []
	sec -= 1
print(''.join(que))


(a, b) = input().split()
(a, b) = (int(a), int(b))
word = input()
list = []
for i in range(len(word)):
	list.append(word[i])
s = 0
lst = []
for i in range(len(word)):
	lst.append(word[i])
for i in range(b):
	for j in range(len(word) - 1):
		if lst[j + 1] == 'G' and lst[j] == 'B':
			list.insert(j + 1, 'B')
			list.pop(j + 2)
			list.insert(j, 'G')
			list.pop(j + 1)
	lst = []
	for i in range(len(list)):
		lst.append(list[i])
word = ''
for i in range(len(list)):
	word = word + list[i]
print(word)


num = [int(n) for n in input().split()]
str = input()
s = list(str)
for i in range(num[1]):
	j = 0
	while j <= len(s) - 2:
		if s[j] == 'B' and s[j + 1] == 'G':
			temp = s[j]
			s[j] = s[j + 1]
			s[j + 1] = temp
			j = j + 2
		else:
			j = j + 1
str = ''
for i in range(len(s)):
	str = str + s[i]
print(str)


import sys
import io
import os
total = 0
failed = 0

def run(test, res):
	x = io.StringIO()
	with io.StringIO(test) as sys.stdin:
		with x as sys.stdout:
			work()
			z = x.getvalue().strip()
	sys.stdout = sys.__stdout__
	print('Passed?', z == res)
	print('Expected: ', res)
	print('Actual  : ', z)
	global total, failed
	total += 1
	failed += 1 if z != res else 0

def work():
	(n, t) = map(int, input().split())
	f = list(input())
	for i in range(0, t):
		c = [''] * n
		for j in range(0, n):
			if j < n - 1 and f[j] == 'B' and (f[j + 1] == 'G'):
				c[j] = f[j + 1]
				c[j + 1] = f[j]
				continue
			if c[j] == '':
				c[j] = f[j]
		f = c
	print(''.join(f))

def test():
	run('5 1\nBGGBG', 'GBGGB')
	run('5 2\nBGGBG', 'GGBGB')
	run('4 1\nGGGB', 'GGGB')
if 'LOCALTEST' in os.environ:
	test()
	print('\n Result: %s (%d total, %d failed)' % ('FAILED' if failed > 0 else 'PASSED', total, failed))
else:
	work()


(n, t) = input().split(' ')
(n, t) = (int(n), int(t))
s = input()
s_char = []
for letter in s:
	s_char.append(letter)
for i in range(t):
	j = 0
	while j <= n - 2:
		if s_char[j + 1] == 'G' and s_char[j] == 'B':
			(s_char[j], s_char[j + 1]) = (s_char[j + 1], s_char[j])
			j += 2
		else:
			j += 1
print(''.join(s_char))


def main(queue, t):
	for j in range(t):
		to_switch = []
		curr_ind = queue.find('BG', 0)
		while curr_ind != -1:
			to_switch.append(curr_ind)
			curr_ind = queue.find('BG', curr_ind + 1, len(queue))
		for i in to_switch:
			queue = queue[:i] + 'GB' + queue[i + 2:]
	return queue
nt = list(map(int, input().split()))
(n, t) = (nt[0], nt[1])
queue = input().strip()
print(main(queue, t))


(n, t) = [int(x) for x in input().split()]
group = str(input())
for i in range(t):
	if 'BG' in group:
		group = group.replace('BG', 'GB')
print(group)


(n, b) = map(int, input().split())
s = input()
i = 0
while i != b:
	s = s.replace('BG', 'GB')
	b -= 1
print(s)


(m, n) = [int(x) for x in input().split()]
abc = input()
for i in range(n):
	cba = ''
	k = int(0)
	while k < m:
		if k == m - 1:
			cba += abc[k]
			break
		if abc[k] == 'B' and abc[k + 1] == 'G':
			cba += 'GB'
			k += 1
		else:
			cba += abc[k]
		k += 1
	abc = cba
print(abc)


vars = input().split()
moves = int(vars[1])
line = input()

def alg(string):
	i = 0
	while i < len(string) - 1:
		if string[i] == 'B' and string[i + 1] == 'G':
			string = string[:i] + 'GB' + string[i + 2:]
			i = i + 2
		else:
			i = i + 1
	return string
for i in range(moves):
	line = alg(line)
print(line)


(n, t) = map(int, input().split())
s = input()
nl = list(s)
for _ in range(t):
	l = nl
	i = 1
	while i < len(l):
		if l[i - 1] == 'B' and l[i] == 'G':
			(l[i - 1], l[i]) = (l[i], l[i - 1])
			i += 1
		i += 1
		nl = l
print(''.join(l))


p = int(input()[2:])
s = input()
while p:
	s = s.replace('BG', 'GB')
	p -= 1
print(s)


(m, n) = [int(x) for x in input().split()]
line = input()
line_ = []
for x in line:
	line_.append(x)
for i in range(n):
	line = str(''.join(line_))
	for a in range(m - 1):
		if line[a] == 'B' and line[a + 1] == 'G':
			line_[a] = 'G'
			line_[a + 1] = 'B'
print(''.join(line_))


(n, t) = map(int, input().split())
st = input()
li = []
for i in st:
	li.append(i)
for _ in range(t):
	i = 0
	for o in range(len(li) - 1):
		try:
			if li[i] == 'B':
				if li[i + 1] == 'G':
					(li[i + 1], li[i]) = ('B', 'G')
					i += 1
			i += 1
		except Exception:
			pass
print(''.join(li))


import sys
(n, t) = map(int, sys.stdin.readline().split())
liste = [char for char in sys.stdin.readline()]
for _ in range(t):
	i = n - 1
	while i > 0:
		if liste[i] == 'G' and liste[i - 1] == 'B':
			liste[i] = 'B'
			liste[i - 1] = 'G'
			i -= 2
		else:
			i -= 1
for i in range(n):
	print(liste[i], end='')


[n, t] = list(map(int, input().split()))
fila = list(input())
ocurrencia = [0] * n
for time in range(t):
	for c in range(n - 1):
		if fila[c:c + 2] == ['B', 'G'] and ocurrencia[c] < 1 and (ocurrencia[c + 1] < 1):
			fila[c:c + 2] = ['G', 'B']
			ocurrencia[c] += 1
			ocurrencia[c + 1] += 1
	ocurrencia = [0] * n
print(''.join(fila))


def Change(Pos):
	Changed = []
	for i in range(len(Pos)):
		if Pos[i] == 'B':
			if i == len(Pos) - 1:
				Changed.append('B')
			elif Pos[i + 1] == 'G':
				Changed.append('G')
				Changed.append('B')
			else:
				Changed.append('B')
		elif i == 0:
			Changed.append('G')
		elif Pos[i - 1] == 'B':
			continue
		elif i == len(Pos):
			Changed.append('G')
		else:
			Changed.append('G')
	return Changed
(People, Sec) = input().split()
People = int(People)
Sec = int(Sec)
Formation = input()
Result = []
for i in range(len(Formation)):
	Result.append(Formation[i])
for i in range(Sec):
	Result = Change(Result)
R = ''
for i in range(len(Result)):
	R = R + Result[i]
print(R)


(s, k) = map(int, input().split())
lst = []
lst.append(list((x for x in input())))
for _ in range(k):
	n = 1
	while True:
		if n < s:
			if lst[0][n - 1] == 'B' and lst[0][n] == 'G':
				(lst[0][n - 1], lst[0][n]) = (lst[0][n], lst[0][n - 1])
				n += 1
			n += 1
		else:
			break
print(''.join(lst[0]))


f = input
(n, t) = f().split()
string = f()
for i in ' ' * int(t):
	string = string.replace('BG', 'GB')
print(string)


l = list(map(int, input().split()))
(n, t) = (l[0], l[1])
s = input()
ch = []
for i in range(t):
	for j in range(len(s[:-1])):
		if s[j] == 'B' and s[j + 1] == 'G':
			ch.append(j)
	for j in ch:
		s = s[:j] + 'GB' + s[j + 2:]
print(s)


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	L = []
	t = s
	while 'BG' in s:
		j = s.index('BG')
		if L != []:
			L += [j + 2 + L[-1]]
		else:
			L += [j]
		s = s[j + 2:]
	s = t
	for k in L:
		s = s[:k] + s[k + 1] + s[k] + s[k + 2:]
print(s)


(n, t) = [int(x) for x in input().split()]
s = input()

def solve(s: str) -> str:
	for _ in range(t):
		s = s.replace('BG', 'GB')
	return s
print(solve(s))


array = []
(n, t) = map(int, input().split())
string = input()
for i in range(0, n):
	array.append(string[i])
i = j = 0
while i < t:
	while j < n - 1:
		if array[j] == 'B' and array[j + 1] == 'G':
			time = array[j]
			array[j] = array[j + 1]
			array[j + 1] = time
			j += 1
		j += 1
	i += 1
	j = 0
for i in range(0, n):
	print(array[i], end='')


import re
(a, b) = map(int, input().split())
c = input()
for i in range(b):
	d = c.split('BG')
	e = 'GB'.join(d)
	c = e
print(e)


from sys import stdin, stdout
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
(n, t) = iia()
s = list(is1())
for i in range(t):
	n_s = s[:]
	for j in range(1, n):
		if s[j - 1] == 'B' and s[j] == 'G':
			n_s[j - 1] = 'G'
			n_s[j] = 'B'
	s = n_s[:]
print(*s, sep='')


a = list(map(int, input().split()))
s = input()
new_s = ''
bool = False
for y in list(range(a[1])):
	for i in list(range(len(s))):
		if bool == False:
			if i + 1 < len(s) and s[i] + s[i + 1] == 'BG':
				new_s += 'GB'
				bool = True
			else:
				new_s += s[i]
		else:
			bool = False
	s = new_s
	new_s = ''
print(s)


def main():
	(lim, t) = list(map(int, input().split()))
	lst = list(input())
	for x in range(t):
		i = 0
		while i < len(lst) - 1:
			if lst[i] == 'B' and lst[i + 1] == 'G':
				lst[i] = 'G'
				lst[i + 1] = 'B'
				i += 2
			else:
				i += 1
	print(''.join(lst))
main()


(b, c) = map(int, input().split())
y = []
e = input()

def swap(s, i, j):
	lst = list(s)
	if i > len(lst) - 1:
		return
	elif i < len(lst) - 1:
		(lst[i], lst[j]) = (lst[j], lst[i])
	elif i == len(lst) - 1:
		lst = list(s)
	aa = ''.join(lst)
	return aa
for j in range(0, len(e)):
	if e[j] == 'B':
		y.append(j)
count = 0
while count < c:
	for n in range(0, len(y)):
		e = swap(e, int(y[n]), int(y[n]) + 1)
	e = e
	y.clear()
	Y = []
	for j in range(0, len(e)):
		if e[j] == 'B':
			y.append(j)
	count = count + 1
print(e)


s = input()
l = s.split()
n = int(l[0])
t = int(l[1])
s = input()
s1 = []
for i in range(n):
	s1.append(s[i])
for i in range(t):
	j = 0
	while j < len(s1) - 1:
		if s1[j] == 'B' and s1[j + 1] == 'G':
			temp = s1[j]
			s1[j] = s1[j + 1]
			s1[j + 1] = temp
			j = j + 1
		j = j + 1
new = ''.join(s1)
print(new)


(queueLength, time) = map(int, input().split())
queue = list(input())
skip = False
for t in range(time):
	for n in range(queueLength):
		if skip:
			skip = False
			continue
		if n + 1 < queueLength and queue[n] == 'B' and (queue[n + 1] == 'G'):
			queue[n] = 'G'
			queue[n + 1] = 'B'
			skip = True
print(''.join(queue))


(n, t) = map(int, input().split())
arr = input()
while 'BG' in arr and t > 0:
	arr = arr.replace('BG', 'GB')
	t -= 1
print(arr)


import copy
(n, k) = map(int, input().split())
s = input()
while k > 0:
	p = []
	i = 0
	while i <= n - 1:
		if i <= n - 2 and s[i] == 'B' and (s[i + 1] == 'G'):
			p.append('G')
			p.append('B')
			i += 2
		else:
			p.append(s[i])
			i += 1
	del s
	s = copy.deepcopy(p)
	del p
	k -= 1
for el in s:
	print(el, end='', sep='')


(n, t) = [int(x) for x in input().split(' ')]
s = list(input())
skipnext = False
for _ in range(t):
	for i in range(0, len(s) - 1):
		if skipnext:
			skipnext = False
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			skipnext = True
	skipnext = False
print(''.join(s))


(_, t) = map(int, input().split())
s = input()
while t > 0:
	i = 0
	s1 = ''
	while i < len(s):
		try:
			if s[i] == 'B' and s[i + 1] == 'G':
				s1 += s[i + 1] + s[i]
				i += 1
			else:
				s1 += s[i]
		except:
			s1 += s[i]
		i += 1
	s = s1
	t -= 1
print(s)


n = list(map(int, str(input()).split(' ')))
st = str(input())
ls = []
for l in st:
	ls.append(l)
for k in range(n[1]):
	i = 0
	while i < len(st) - 1:
		if ls[i] == 'B' and ls[i + 1] == 'G':
			ls[i] = 'G'
			ls[i + 1] = 'B'
			i += 1
		i += 1
print(''.join(ls))


pt = list(map(int, input().split()))
p = input()
s = ''
for i in range(pt[1]):
	p = p.replace('BG', 'GB')
print(p)


(n, t) = map(int, input().split())
fil = list(input())
for i in range(t):
	b = 0
	while b < n - 1:
		if fil[b] == 'B' and fil[b + 1] == 'G':
			fil[b] = 'G'
			fil[b + 1] = 'B'
			b += 1
		b += 1
print(''.join(fil))


(n, t) = map(int, input().split())
s = input()
(s_var1, s_var2) = (list(s), list(s))
timed = ''
for i in range(t):
	for j in range(n - 1):
		if s_var1[j] == 'B' and s_var1[j + 1] == 'G':
			(s_var2[j], s_var2[j + 1]) = (s_var2[j + 1], s_var2[j])
	timed = ''.join(s_var2)
	s_var1 = list(timed)
for item in s_var1:
	print(item, end='')
print('')


w = input().split()
(n, t) = (int(w[0]), int(w[1]))
q = list(input())
for times in range(t):
	points = []
	for i in range(n - 1):
		if q[i] == 'B' and q[i + 1] == 'G':
			points.append(i)
	for point in points:
		(q[point], q[point + 1]) = ('G', 'B')
out = ''
for i in q:
	out += i
print(out)


import sys
from copy import copy
(n, t) = map(int, input().split())
s = list(input())
for t_ in range(t):
	a = copy(s)
	for i in range(n - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			a[i] = 'G'
			a[i + 1] = 'B'
	s = a
print(''.join(s))


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	j = 0
	a = ''
	while j < n - 1:
		if s[j] == 'G':
			a += 'G'
		elif s[j + 1] == 'G':
			a += 'GB'
			j += 1
		else:
			a += 'B'
		j += 1
	if len(a) < n:
		a += s[-1]
	s = a
print(s)


(n1, n2) = map(int, input().split())
Str = list(input())
for i in range(n2):
	j = 0
	while j < n1:
		if j + 1 < n1 and (Str[j] == 'B' and Str[j + 1] == 'G'):
			(Str[j], Str[j + 1]) = ('G', 'B')
			j += 1
		j += 1
print(*Str, sep='')


(q_len, no_moves) = [int(x) for x in input().split()]
string = list(input())
no_test = q_len
j_start = 0
for i in range(no_moves):
	j = 0
	while j < q_len - 1:
		if string[j] == 'B' and string[j + 1] == 'G':
			(string[j + 1], string[j]) = (string[j], string[j + 1])
			j += 2
		else:
			j += 1
print(''.join(string))


(x, y) = map(int, input().split())
z = input()
for a in range(y):
	z = z.replace('BG', 'GB')
print(z)


(n, m) = map(int, input().split())
s = input()
t = ''
i = 0
for _ in range(m):
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			t += 'GB'
			i += 2
		else:
			t += s[i]
			i += 1
	if len(t) != len(s):
		l = n - (len(s) - len(t))
		t += s[l:]
	s = t
	i = 0
	t = ''
print(s)


(N, T) = map(int, input().split())
S = input()
slist = []
for i in range(0, N):
	slist.append(S[i])
for i in range(0, T):
	changelist = []
	for j in range(0, N - 1):
		if slist[j] == 'B' and slist[j + 1] == 'G':
			changelist.append(j)
	for k in range(0, len(changelist)):
		tmp = slist[changelist[k]]
		slist[changelist[k]] = slist[changelist[k] + 1]
		slist[changelist[k] + 1] = tmp
ans = ''
for i in range(0, N):
	ans = ans + slist[i]
print(ans)


(n, t) = map(int, input().split())
a = list(input())
i = 0
for j in range(t):
	while i < n:
		if a[i:i + 2] == ['B', 'G']:
			a.pop(i + 1)
			a.insert(i, 'G')
			i += 1
		i += 1
	i = 0
for i in range(n):
	print(a[i], end='')


a = list(map(int, input().split()))

def f(a, b):
	if b == 0:
		return a
	a = list(a)
	l = len(a)
	c = [0 for i in range(l)]
	for i in range(l):
		c[i] = a[i]
	for i in range(1, l):
		if a[i] == 'G' and a[i - 1] == 'B':
			c[i] = 'B'
			c[i - 1] = 'G'
	c = ''.join(c)
	return f(c, b - 1)
m = input()
print(f(m, a[1]))


i = input().split()
(n, t) = (int(i[0]), int(i[1]))
queue = input()
for time in range(t):
	condition = True
	for i in range(n):
		if i + 1 < n:
			if queue[i] == 'B' and queue[i + 1] == 'G' and condition:
				queue = queue[:i] + 'G' + 'B' + queue[i + 2:]
				condition = False
			elif not condition:
				condition = True
print(queue)


(n, k) = map(int, input().split())
s = input()
for i in range(k):
	A = []
	for j in range(n - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			A.append(j)
	if len(A) == 0:
		break
	for j in A:
		s = s[:j] + s[j + 1] + s[j] + s[j + 2:]
print(s)


counts = input().split()
no_of_student = int(counts[0])
times = int(counts[1])
queue = input()
while times:
	i = 0
	while i < len(queue):
		if i != len(queue) - 1 and queue[i] == 'B' and (queue[i + 1] == 'G'):
			queue = queue[:i] + 'GB' + queue[i + 2:]
			i = i + 1
		i = i + 1
	times -= 1
print(''.join(queue))


(ppl, steps) = list(map(int, input().split()))
pplList = list((x == 'B' for x in input()))
swap = False
for step in range(steps):
	for x in range(1, len(pplList)):
		if not pplList[-x] and pplList[-x - 1] and (not swap):
			pplList[-x] = True
			pplList[-x - 1] = False
			swap = True
		else:
			swap = False
outStr = ''
for x in pplList:
	outStr = outStr + ('B' if x else 'G')
print(outStr)


nt = input().split()
n = int(nt[0])
t = int(nt[1])
s = list(input())
for _ in range(t):
	ind = [i for i in range(n) if s[i] == 'B']
	for i in ind:
		if i != n - 1:
			(s[i + 1], s[i]) = (s[i], s[i + 1])
print(''.join(s))


__author__ = 'myduomilia'
(n, t) = list(map(int, input().split()))
arr = list(input())
while t > 0:
	t -= 1
	bool = False
	for i in range(1, len(arr)):
		if bool:
			bool = False
			continue
		if arr[i - 1] == 'B' and arr[i] == 'G':
			(arr[i - 1], arr[i]) = (arr[i], arr[i - 1])
			bool = True
print(''.join(arr))


(n, sec) = input().split()
n = int(n)
sec = int(sec)
string = input()
l = []
for i in string:
	l.append(i)
while sec:
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			l[i] = 'G'
			l[i + 1] = 'B'
			i += 2
		else:
			i += 1
	sec -= 1
string = ''.join(l)
print(string)


(n, k) = map(int, input().split())
s = input()
i = 0
while k != 0:
	x = s.count('BG')
	s = s.replace('BG', 'GB', x)
	k = k - 1
print(s)


x = list(input().split(' '))
y = list(input())
if len(y) == int(x[0]) and int(x[0]) <= 50 and (int(x[1]) <= 50):
	for i in range(int(x[1])):
		j = 0
		while j < len(y) - 1:
			if y[j] == 'B' and y[j + 1] == 'G':
				(y[j], y[j + 1]) = (y[j + 1], y[j])
				j += 2
			else:
				j += 1
print(''.join(y))


li = str(input('')).split()
queue = str(input(''))
n = len(queue)
l = list(queue)
for i in range(0, 2):
	li[i] = int(li[i])
for j in range(0, li[1]):
	q = []
	for k in range(0, n - 1):
		if l[k] == 'B' and l[k + 1] == 'G':
			q.append(k)
	for rank in q:
		c = l[rank]
		l[rank] = l[rank + 1]
		l[rank + 1] = c
print(''.join(l))


def swap(input):
	a = 0
	while not a + 1 > len(input):
		if a + 1 < len(input):
			if input[a] < input[a + 1]:
				temp = input[a]
				input[a] = input[a + 1]
				input[a + 1] = temp
				a = a + 2
			else:
				a = a + 1
		else:
			break
	return input

def main():
	inn = input()
	inn.index(' ')
	repeat = int(inn[inn.index(' '):])
	data = input()
	data_d = []
	for a in data:
		data_d.append(a)
	for a in range(repeat):
		data = swap(data_d)
	output = ''
	for b in data_d:
		output = output + b
	print(output)
main()


import sys
(n, t) = map(int, sys.stdin.readline().split())
q = list(input())
for i in range(t):
	index = 0
	while index + 1 < n:
		if q[index] == 'B' and q[index + 1] == 'G':
			(q[index], q[index + 1]) = (q[index + 1], q[index])
			index += 2
		else:
			index += 1
print(''.join(q))


(n, t) = map(int, input().split())
s = input()
for k in range(t):
	i = 0
	a = ''
	while i < n:
		if s[i:i + 2] == 'BG':
			a += 'GB'
			i += 2
		else:
			a += s[i]
			i += 1
	s = a
print(s)


(n, t) = tuple(map(int, input().split()))
s = input()
for _ in range(t):
	i = 1
	while i < n:
		if s[i - 1] == 'B' and s[i] == 'G':
			if i == n - 1:
				temp = ''
			else:
				temp = s[i + 1:]
			s = s[:i - 1] + 'GB' + temp
			i += 2
		else:
			i += 1
print(s)


(n, k) = map(int, input().split())
s = list(input())
for i in range(k):
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			(s[j], s[j + 1]) = (s[j + 1], s[j])
			s[j + 1] = 'b'
	for i in range(len(s)):
		s[i] = s[i].upper()
print(''.join(s))


(n, t) = map(int, input().split())
ia = list(input())
for item in range(t):
	count = 0
	while count + 1 < n:
		if ia[count] == 'B' and ia[count + 1] == 'G':
			ia[count] = 'G'
			ia[count + 1] = 'B'
			count = count + 2
		else:
			count = count + 1
str = ''
for element in ia:
	str += element
print(str)


s = input()
L = list(map(int, s.split()))
ch = input()
T = list(ch)
for i in range(L[1]):
	j = 0
	while j < L[0] - 1:
		if T[j] == 'B' and T[j + 1] == 'G':
			a = T[j]
			T[j] = T[j + 1]
			T[j + 1] = a
			j += 1
		j += 1
ch = ''.join(T)
print(ch)


(n, t) = [int(x) for x in input().split()]
s = input()
for r in range(t):
	nxt = ''
	flag = True
	for i in range(len(s) - 1):
		if flag:
			if s[i] == 'B' and s[i + 1] != 'B':
				nxt += s[i + 1] + 'B'
				flag = False
			else:
				nxt += s[i]
		else:
			flag = True
	if len(nxt) + 1 == len(s):
		nxt += s[len(s) - 1]
	s = nxt
print(s)


def newstring(a):
	l = ''
	f = 0
	while f < len(a):
		if a[f] == 'B' and f < len(a) - 1:
			if a[f + 1] == 'G':
				l = l + 'G'
				l = l + 'B'
				f = f + 2
			else:
				l = l + 'B'
				f = f + 1
		elif a[f] == 'B':
			l = l + 'B'
			f = f + 1
		else:
			l = l + 'G'
			f = f + 1
	return l
b = input()
b = list(map(int, b.split()))
c = input()
for i in range(0, b[1]):
	c = newstring(c)
print(c)


list = input().split()
n = int(list[0])
t = int(list[1])
str = input()
strs = []
i = 0
for i in range(0, n):
	strs.append(str[i])
j = 0
for j in range(0, t):
	k = 0
	while k < n - 1:
		if strs[k] == 'B' and strs[k + 1] == 'G':
			strs[k] = 'G'
			strs[k + 1] = 'B'
			k += 2
		else:
			k += 1
m = 0
for m in range(0, n):
	print(strs[m], end='')


(m, q) = map(int, input().split())
l = list(input())
for i in range(q):
	s = []
	for j in range(m - 1):
		if (l[j] == 'B') & (l[j + 1] == 'G'):
			s.append(j)
	for k in range(len(s)):
		x = s[k - 1]
		l[x] = 'G'
		l[x + 1] = 'B'
print(''.join(l))


(n, t) = map(int, input().split())
s = [str(x) for x in input()]
while t != 0:
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i += 1
		i += 1
	t -= 1
for i in s:
	print(i, end='')


(a, b) = map(int, input().split())
q = list(input())
done = False
for i in range(b):
	done = False
	for k in range(a - 1):
		if done == True:
			done = False
			continue
		if q[k] == 'B' and q[k + 1] == 'G':
			q[k] = 'G'
			q[k + 1] = 'B'
			done = True
print(''.join(q))


(n, t) = map(int, input().split())
s = input()
for i in range(t):
	for j in range(0, len(s) - 1):
		if s[j:j + 2] == 'BG':
			s = s[:j] + 'gb' + s[j + 2:]
	s = s.upper()
print(s)


(n, t) = map(int, input().split())
p = []
for i in input():
	if i == 'B':
		p.append(1)
	else:
		p.append(0)
line = ''
for i in range(t):
	j = 0
	while j < n - 1:
		if p[j] == 1 and p[j + 1] == 0:
			(p[j], p[j + 1]) = (p[j + 1], p[j])
			j += 2
		else:
			j += 1
for i in p:
	if i:
		line += 'B'
	else:
		line += 'G'
print(line)


(n, t) = map(int, input().split())
l = []
data = [i for i in input()]
for _ in range(t):
	for i in range(n - 1):
		if data[i] == 'B' and data[i + 1] == 'G':
			l.append(i)
	while l:
		k = l.pop()
		(data[k], data[k + 1]) = ('G', 'B')
print(*data, sep='')


(n, t) = map(int, input().split())
s = input()
s = list(s)
x = ''
for i in range(t):
	for l in range(n):
		if l < n - 1:
			if s[l] == 'B' and s[l + 1] == 'G':
				x = x + 'G' + 'B'
				s[l] = '0'
				s[l + 1] = '0'
				if l == len(s) - 2:
					break
			elif s[l] != '0':
				x = x + s[l]
				s[l] = '0'
	if s[n - 1] != '0':
		x = x + s[n - 1]
		s[n - 1] = '0'
	s = list(x)
	if i < t - 1:
		x = ''
print(x)


(n, t) = map(int, input('').split(' '))
q = input('')
for i in range(t):
	x = 0
	if i == 0:
		a = ''
	else:
		q = a
		a = ''
	while x < n:
		if x < n - 1 and q[x] == 'B' and (q[x + 1] == 'G'):
			a += 'G'
			a += 'B'
			x += 1
		else:
			a += q[x]
		x += 1
print(a)


n = input()
n = n.split()
t = int(n[1])
s = input()
v = list(s)
f = 0
for i in range(t):
	for j in range(len(s)):
		if f == 1:
			f = 0
			continue
		if j + 1 < len(s):
			if v[j] == 'B' and v[j + 1] == 'G':
				t = v[j]
				v[j] = v[j + 1]
				v[j + 1] = t
				f = 1
x = ''.join(v)
print(x)


(n, t) = [int(x) for x in input().split()]
l = list(input())
for i in range(t):
	j = []
	for i in range(n - 1):
		if l[i] == 'B' and l[i + 1] == 'G' and (i not in j):
			(l[i], l[i + 1]) = ('G', 'B')
			j.append(i + 1)
s = str()
for i in range(n):
	s += l[i]
print(s)


(n, t) = map(int, input().split())
data = [i for i in input()]
toskip = False
for _ in range(t):
	for i in range(n):
		if toskip:
			toskip = False
			continue
		try:
			if data[i] == 'B' and data[i + 1] == 'G':
				(data[i], data[i + 1]) = (data[i + 1], data[i])
				toskip = True
		except IndexError:
			break
for i in data:
	print(i, end='')


a = list(map(int, input().rstrip().split()))
s = str(input())
for _ in range(a[1]):
	s = s.replace('BG', 'GB')
print(s)


(count, t) = map(int, input().split())
s = list(input())
for i in range(t):
	j = 1
	while j < len(s):
		if s[-j] == 'G' and j + 1 <= len(s):
			if s[-j - 1] != 'G':
				(a, b) = (s[-j], s[-j - 1])
				s[-j] = b
				s[-j - 1] = a
				j += 2
			else:
				j += 1
		else:
			j += 1
print(''.join(s))


def solution(n, t, data):
	data = list(data)
	changed = False
	for j in range(t):
		i = 1
		while i < n:
			if data[i - 1] == 'B' and data[i] == 'G':
				changed = True
				(data[i - 1], data[i]) = (data[i], data[i - 1])
				i += 1
			i += 1
		if not changed:
			break
		else:
			changed = False
	return ''.join(data)

def main():
	(n, t) = [int(x) for x in input().split()]
	data = input()
	print(solution(n, t, data))
main()


(n, t) = map(int, input().split())
s = list(input())
s1 = s[:]
while t:
	for i in range(len(s) - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			(s1[i], s1[i + 1]) = (s1[i + 1], s1[i])
	t -= 1
	s = s1[:]
print(*s1, sep='')


line = input()
line = line.split(' ')
people = int(line[0])
seconds = int(line[1])
line = input()
queue = [0] * people
for i in range(people):
	if line[i] == 'B':
		queue[i] = 1
for i in range(seconds):
	i = 0
	while i < people - 1:
		if queue[i] > queue[i + 1]:
			temp = queue[i]
			queue[i] = queue[i + 1]
			queue[i + 1] = temp
			i += 2
		else:
			i += 1
line = ''
for element in queue:
	if element == 0:
		line += 'G'
	else:
		line += 'B'
print(line)


(no_of_ppl, time) = map(int, input().split())
l = list(input())
while time != 0:
	i = 0
	while i < len(l) - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = ('G', 'B')
			i = i + 1
		i = i + 1
	time = time - 1
print(''.join(l))


(children, seconds) = [int(x) for x in input().split(' ')]
line = input()
for i in range(seconds):
	line = line.replace('BG', 'GB')
print(line)


_number = input().split(' ')
order = input()
t = int(_number[1])
for i in range(t):
	result = order.replace('BG', 'GB')
	order = result
print(result)


def func(x, y):
	for i in range(t):
		j = 0
		while j < len(x) - 1:
			if x[j] == 'B' and x[j + 1] == 'G':
				(x[j], x[j + 1]) = (x[j + 1], x[j])
				j += 1
			j += 1
	return x
(n, t) = map(int, input().strip().split())
a = list(input().strip())
print(''.join(map(str, func(a, t))))


(n, t) = map(int, input().strip().split())
s = list(input())
if n == 1:
	print(''.join(s))
else:
	while t > 0:
		i = 0
		while True:
			if i >= n - 1:
				break
			elif s[i] == 'B' and s[i + 1] == 'G':
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				i += 2
			else:
				i += 1
		t -= 1
	print(''.join(s))


inp = list(map(int, input().split(' ')))
queue = list(input())
for i in range(inp[1]):
	i = 1
	while i < len(queue):
		if queue[i - 1] == 'B' and queue[i] == 'G':
			(queue[i], queue[i - 1]) = (queue[i - 1], queue[i])
			i += 2
		else:
			i += 1
print(''.join(queue))


(n, t) = map(int, input().split())
string = input()
string1 = list(string)
while t > 0:
	indices = []
	start = 0
	while True:
		try:
			indices.append(''.join(string1).index('BG', start))
			start = ''.join(string1).index('BG', start) + 1
		except ValueError:
			break
	for i in indices:
		string1[i] = 'G'
		string1[i + 1] = 'B'
	t -= 1
print(''.join(string1))


(n, t) = input().split()
s = input()
l = []
for i in s:
	l.append(i)
l1 = l[:]
for i in range(int(t)):
	l = l1[:]
	for j in range(0, len(l) - 1):
		if l[j] == 'B' and l[j + 1] == 'G':
			t = l1[j]
			l1[j] = l1[j + 1]
			l1[j + 1] = t
print(''.join(l1))


a = list(map(int, input().rstrip().split()))
n = a[0]
t = a[1]
x = 0
st = input()
q = []
for i in range(len(st)):
	q.append(st[i])
while x < t:
	i = 0
	while i < len(q) - 1:
		if q[i] == 'B' and q[i + 1] == 'G':
			q[i] = 'G'
			q[i + 1] = 'B'
			i = i + 2
		else:
			i += 1
	x += 1
for i in range(len(q)):
	print(q[i], end='')


i1 = list(map(int, input().split()))
a = input()
for i in range(i1[1]):
	a = a.replace('BG', 'GB')
print(a)


(n, t) = list(map(int, input().strip().split(' ')))
queue = input()
for _ in range(t):
	queue = queue.replace('BG', 'GB')
print(queue)


import math
line = input()
args = line.split(' ')
n = int(args[0])
t = int(args[1])
s = input()
while t > 0:
	t = t - 1
	s = s.replace('BG', 'GB')
print(s)


(a, b) = map(int, input().split())
s = input()
s = list(s)
while b:
	b -= 1
	tmp = s.copy()
	for i in range(a - 1):
		if s[i] == 'B' and s[i + 1] == 'G':
			(tmp[i], tmp[i + 1]) = (tmp[i + 1], tmp[i])
	s = tmp
print(*s, sep='')


(size, t) = map(int, input().split())
line = list(input())
for i in range(t):
	temp = 0
	while temp < size - 1:
		if line[temp] == 'B' and line[temp + 1] == 'G':
			(line[temp], line[temp + 1]) = ('G', 'B')
			temp += 2
		else:
			temp += 1
ans = ''
for ele in line:
	ans = ans + str(ele)
print(ans)


(n, t) = str(input()).split(' ')
n = int(n)
t = int(t)
line = str(input())
for i in range(t):
	line = line.replace('BG', 'GB')
print(line)


a = [int(x) for x in input().split()]
s = input()
l = []
n = 0
i = 1
for x in s:
	l.append(x)
if len(l) <= 1:
	print(s)
else:
	for x in range(a[1]):
		while i < len(l):
			if l[i - 1] == 'B' and l[i] == 'G':
				l.insert(i + 1, ',')
				l[i - 1] = 'G'
				l[i] = 'B'
			i += 1
		for m in l:
			if m == ',':
				l.remove(m)
		i = 1
	print(''.join(l))


(n, k) = map(int, input().split())
s = input()
l = list(s)
ans = []
for i in range(0, k):
	for j in range(0, n):
		if l[j] == 'G' and j != 0:
			if count == 1:
				temp = l[j]
				l[j] = l[j - 1]
				l[j - 1] = temp
				count = 0
			else:
				count = 0
		else:
			count = 1
for x in l:
	print(x, end='')


import copy
l = list(map(int, input().split(' ')))
a = list(input())
n = l[0]
t = l[1]
k = 0
b = copy.copy(a)
while k < t:
	for i in range(1, n):
		if a[i] == 'G' and a[i - 1] == 'B':
			b[i - 1] = 'G'
			b[i] = 'B'
	a = copy.copy(b)
	k = k + 1
print(''.join(a))


(n, t) = map(int, input().split())
s1 = input()
s = []
for i in range(n):
	s.append(s1[i])
b = 0
for i in range(t):
	b = 0
	for j in range(n - 1):
		if b == 1:
			b = 0
		elif b == 0 and s[j] == 'B' and (s[j + 1] == 'G'):
			s[j] = 'G'
			s[j + 1] = 'B'
			b = 1
ans = ''.join(s)
print(ans)


import sys
(n, t) = tuple([int(x) for x in sys.stdin.readline().split()])
s = list(sys.stdin.readline().strip())
for i in range(t):
	ss = s[:]
	for j in range(len(s) - 1):
		if s[j] == 'B' and s[j + 1] == 'G':
			ss[j] = 'G'
			ss[j + 1] = 'B'
	s = ss
print(''.join(s))


(n, t) = map(int, input().split())
boysgirls = list(input())
skip = 0
for j in range(t):
	for i in range(0, n - 1):
		if boysgirls[i] == 'B' and boysgirls[i + 1] == 'G' and (skip == 0):
			(boysgirls[i], boysgirls[i + 1]) = (boysgirls[i + 1], boysgirls[i])
			skip = 1
		else:
			skip = 0
	skip = 0
print(''.join(boysgirls))


(n, t) = input().split()
n = int(n)
t = int(t)
s = input()
array = []
for i in range(n):
	array.append(s[i])
for j in range(t):
	counter = 0
	for i in range(n):
		if counter >= n - 1:
			break
		elif array[counter] == 'B' and array[counter + 1] == 'G':
			array[counter] = 'G'
			array[counter + 1] = 'B'
			counter += 2
		else:
			counter += 1
a = ''.join(array)
print(a)


line = input().strip().split()
length = int(line[0])
time = int(line[1])
line = list(input())
for _ in range(time):
	i = 1
	while i < length:
		if line[i] == 'G' and line[i - 1] == 'B':
			line[i] = 'B'
			line[i - 1] = 'G'
			i += 1
		i += 1
print(''.join(line))


(n, b) = list(map(int, input().split()))
lph = input()
for i in range(b):
	lph = lph.replace('BG', 'GB')
print(lph)


from collections import deque
(n, t) = map(int, input().split())
s = str(input())
while t:
	s = s.replace('BG', 'GB')
	t = t - 1
print(s)


import re
(a, y) = input().split()
x = input()
y = int(y)
for j in range(y):
	x = re.sub('BG', 'GB', x)
print(x)


(n, t) = input().split(' ')
n = int(n)
t = int(t)
m = list(input())
s = m.copy()
i = 0
while i < t:
	j = 0
	x = 0
	while j < n - 1:
		if m[j] == 'B' and m[j + 1] == 'G':
			x += 1
			te = s[j]
			s[j] = s[j + 1]
			s[j + 1] = te
		j += 1
	if x == 0:
		j = n
		i = t
	i += 1
	m = s.copy()
print(''.join(s))


def fuck(sam, k, l):
	if k == 0:
		return
	else:
		r = 0
		while r < l - 1:
			if sam[r] == 'B' and sam[r + 1] == 'G':
				sam[r + 1] = 'B'
				sam[r] = 'G'
				r = r + 2
			else:
				r = r + 1
		fuck(sam, k - 1, l)
(n, k) = map(int, input().split())
arr = list(input())
fuck(arr, k, n)
str1 = ''.join(arr)
print(str1)


(a, b) = (int(i) for i in input().split())
c = list(input())
for i in range(b):
	tempc = c.copy()
	for j in range(1, len(c)):
		if c[j - 1] == 'B' and c[j] == 'G':
			tempc[j - 1] = 'G'
			tempc[j] = 'B'
		else:
			tempc[j] = c[j]
	c = tempc.copy()
print(''.join(c))


A = [int(x) for x in input().split()]
X = list(input())
G = []
B = []
n = 0
for i in range(0, A[0]):
	if X[i] == 'B':
		B.append(i)
	else:
		G.append(i)
N = len(B)
while n < A[1]:
	n += 1
	i = 0
	G1 = G
	B1 = B
	while i < N:
		if B[i] + 1 in G:
			m = B[i]
			G1.remove(m + 1)
			G1.append(m)
			B1.remove(m)
			B1.insert(0, m + 1)
		i += 1
	G = G1
	B = B1
p = ''
for x in range(0, A[0]):
	if x in B:
		p = p + 'B'
	else:
		p = p + 'G'
print(p)


(n, t) = map(int, input().split())
s = input()
l = [s]
while t:
	l.append(l[-1].replace('BG', 'GB'))
	t -= 1
print(l[-1])


(n, t) = [int(x) for x in input().split()]
a = list(input())
k = 1
for i in range(t):
	for m in range(n - 1, 0, -1):
		if k == 0:
			a[m] = a[m]
			k = 1
		elif a[m] == 'G' and m > 0 and (a[m - 1] != 'G'):
			a[m] = 'B'
			a[m - 1] = 'G'
			k = 0
for w in range(n):
	print(a[w], end='')


(n, t) = map(int, input().split())
s = input()
for j in range(t):
	new_string = ''
	for i in range(n):
		s = s + ' '
		if len(new_string) == i + 1:
			continue
		if s[i] == 'B' and s[i + 1] == 'G':
			new_string += 'GB'
		else:
			new_string += s[i]
	s = new_string
print(new_string)


(n, t) = map(int, input().split())
li = list(map(str, input().strip()))
k = 1
for i in range(t):
	j = 0
	while n - 2 >= j:
		if li[j] == 'B' and li[j + 1] == 'G':
			li[j] = 'G'
			li[j + 1] = 'B'
			j += 2
		else:
			j += 1
for i in li:
	print(i, end='')


n = list(map(int, input().split()))
children = input()
children = list(children)
current = None
for j in range(n[1]):
	for i in range(len(children)):
		if children[i] == 'B':
			current = 'B'
		elif children[i] == 'G' and current == 'B':
			children[i] = 'B'
			children[i - 1] = 'G'
			current = None
	current = None
print(''.join(children))


a = input()
b = input()
c = a.split()

def f(m, n):
	if n == 0:
		return m
	else:
		m = m.replace('BG', 'GB')
		return f(m, n - 1)
print(f(b, int(c[1])))


ar = [int(n) for n in input().split()]
s = input()
for i in range(ar[1]):
	s = s.replace('BG', 'GB')
	continue
print(s)


(n, t) = map(int, input().strip().split())
l = list(input().strip())
res = []
while t > 0:
	res = []
	for i in range(0, n - 1):
		if l[i] == 'B' and l[i + 1] == 'G':
			res.append(i)
	for i in range(0, len(res)):
		(l[res[i]], l[res[i] + 1]) = (l[res[i] + 1], l[res[i]])
	t -= 1
print(''.join((str(x) for x in l)))


(n, t) = map(int, input().split())
s = input()
L = list(s)
for i in range(t):
	temp = L[:]
	for i in range(1, n):
		if L[i - 1] == 'B' and L[i] == 'G':
			temp[i - 1] = 'G'
			temp[i] = 'B'
	L = temp[:]
s1 = ''
for i in L:
	s1 += i
print(s1)


(q, t) = map(int, input().split(' '))
queue = input()
while t >= 1:
	queue = queue.replace('BG', 'GB')
	t -= 1
print(queue)


(n, t) = list(map(int, input().split()))
s = input().upper()
l1 = list(s)

def exchg(l, lt):
	i = 0
	while i < lt - 1:
		if l[i] == 'B' and l[i + 1] == 'G':
			(l[i], l[i + 1]) = (l[i + 1], l[i])
			i = i + 2
		else:
			i = i + 1
	return l
for i in range(t):
	exchg(l1, n)
st = ''
for i in range(n):
	st = st + l1[i]
print(st)


from sys import stdin
(lines, line_index) = (stdin.readlines(), -1)

def get_line():
	global lines, line_index
	line_index += 1
	return lines[line_index]

def main():
	(n, t) = [int(x) for x in get_line().split()]
	orig = list(get_line().strip())
	copy = orig
	for _ in range(t):
		orig = copy
		copy = orig[:]
		swap = False
		for i in range(n - 1):
			if orig[i] == 'B' and orig[i + 1] == 'G':
				(copy[i], copy[i + 1]) = (copy[i + 1], copy[i])
				swap = True
		if not swap:
			break
	print(''.join(copy))
main()


(tam, vezes) = map(int, input().split())
pesso = list(input())
i = 1
for j in range(vezes):
	while i < tam:
		if pesso[i - 1] == 'B' and pesso[i] == 'G':
			(pesso[i], pesso[i - 1]) = (pesso[i - 1], pesso[i])
			i += 2
			continue
		i += 1
	i = 1
for i in pesso:
	print(i, end='')
print('')


(a, b) = map(int, input().split())
s = str(input())
c = []
for i in s:
	c.append(i)
for i in range(b):
	j = 0
	while j < len(s):
		if j != len(s) - 1:
			if c[j] == 'B' and c[j + 1] == 'G':
				t = c[j]
				c[j] = c[j + 1]
				c[j + 1] = t
				j = j + 2
			else:
				j = j + 1
		else:
			j = j + 1
t = ''
for i in c:
	t = t + i
print(t)


(n, t) = map(int, input().split())
s = input()
while t:
	t -= 1
	a = ''
	p = 0
	while p < len(s):
		if p == len(s) - 1:
			a += s[p]
			break
		if s[p] == 'B' and s[p + 1] == 'G':
			a += 'GB'
			p += 2
		else:
			a += s[p]
			p += 1
	s = a
print(a)


(n, k) = map(int, input().split())
s = list(input())
while k:
	x = 0
	while x < n - 1:
		if s[x] == 'B' and s[x + 1] == 'G':
			s[x] = 'G'
			s[x + 1] = 'B'
			x += 1
		x += 1
	k -= 1
s1 = ''.join(s)
print(s1)


(n, t) = map(int, input().split())
a = input()
j = 0
while j < t:
	if 'BG' in a:
		a = a.replace('BG', 'GB')
	j += 1
print(a)


numbers = input()
numbers = numbers.split(' ')
n = int(numbers[0])
t = int(numbers[1])
s = input()
for i in range(t):
	list = s.split('BG')
	s = 'GB'.join(list)
print(s)


(n, t) = list(map(int, input().split()))
s = input()
ls = []
for i in s:
	ls.append(i)
for i in range(t):
	nls = ls.copy()
	for i in range(len(ls) - 1):
		if ls[i] == 'B' and ls[i + 1] == 'G':
			(nls[i], nls[i + 1]) = (nls[i + 1], nls[i])
	ls = nls
print(''.join(nls))


(n, k) = list(map(int, input().split()))
g = list(input())
for x in range(0, k):
	i = 0
	while i < n - 1:
		if g[i] == 'B' and g[i + 1] == 'G':
			g[i] = 'G'
			g[i + 1] = 'B'
			i += 2
		else:
			i += 1
z = ''
for x in g:
	z += x
print(z)


def oneTimeStep(s):
	n = len(s)
	i = 0
	while i < n - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 1
		i += 1
	return s
(n, t) = (int(x) for x in input().split(' '))
s = list(input())
for _ in range(t):
	s = oneTimeStep(s)
print(''.join((c for c in s)))


(n, m) = map(int, input().split(' '))
mas = list(input())
for i in range(m):
	j = 0
	while j < len(mas) - 1:
		if mas[j] == 'B' and mas[j + 1] == 'G':
			mas[j] = 'G'
			mas[j + 1] = 'B'
			j += 1
		j += 1
print(''.join(mas))


(n, k) = map(int, input().split())
a = input()
for j in range(k):
	if 'BG' in a:
		a = a.replace('BG', 'GB')
print(a)


spl = input().split(' ')
n = int(spl[0])
t = int(spl[1])
line = input()
q = [ch for ch in line]
for _ in range(t):
	index = 0
	while index < n - 1:
		if q[index] == 'B' and q[index + 1] == 'G':
			q[index] = 'G'
			q[index + 1] = 'B'
			index += 1
		index += 1
for ch in q:
	print(ch, end='')


(n, t) = map(int, input().split())
s = input()

def swap(x, y):
	global s
	p = s[x]
	q = s[y]
	s = s[0:x] + q + s[x + 1:y] + p + s[y + 1:n]
while t > 0:
	t -= 1
	fla = False
	for i in range(0, n - 1):
		if s[i] == 'B' and s[i + 1] == 'G' and (fla == False):
			swap(i, i + 1)
			fla = True
		else:
			fla = False
print(s)


(x, y) = map(int, input().split())
q = list(input())
for i in range(0, y):
	j = 0
	while j + 1 < x:
		if q[j] == 'B' and q[j + 1] == 'G':
			q[j] = 'G'
			q[j + 1] = 'B'
			j += 2
		else:
			j += 1
for c in q:
	print(c, end='')


def change(quel, que):
	i = 0
	while i < quel - 1:
		if que[i] == 'B' and que[i + 1] == 'G':
			(que[i], que[i + 1]) = (que[i + 1], que[i])
			i += 2
		else:
			i += 1
	return que
(quel, tim) = map(int, input().split())
que = list(input())
for i in range(tim):
	res = change(quel, que)
print(''.join(res))


inputNumbers = input()
inputQ = input()
q = []
for i in inputNumbers.split(' '):
	q.append(i)
n = q[0]
t = int(q[1])
while t > 0:
	index = 0
	for i in inputQ:
		inputQList = list(inputQ)
		if i == 'B' and index + 1 != len(inputQ):
			if inputQList[index + 1] == 'G':
				var = inputQList[index + 1]
				inputQList[index + 1] = inputQList[index]
				inputQList[index] = var
		index += 1
		inputQ = ''.join(inputQList)
	t -= 1
print(inputQ)


(q, t) = map(int, input().split())
s = input()
s = [i for i in s]
for time in range(t):
	i = 0
	while i < len(s) - 1:
		if s[i] == 'B' and s[i + 1] == 'G':
			(s[i], s[i + 1]) = (s[i + 1], s[i])
			i = i + 2
		else:
			i += 1
print(''.join(s))


(n, t) = (int(i) for i in input().split())
raw = input()
if len(raw) == n:
	s = []
	for i in raw:
		s.append(i)
	for i in range(t):
		j = 0
		while j < len(s):
			if s[j] == 'B' and j + 1 < len(s) and (s[j + 1] == 'G'):
				(s[j], s[j + 1]) = (s[j + 1], s[j])
				j += 1
			j += 1
	print(''.join(s))
else:
	print('Incorrect size')


(n, t) = [int(i) for i in input().split()]
s = list(input())
i = 0
for _ in range(int(t)):
	for _ in range(n):
		if i < n - 1 and s[i] == 'B' and (s[i + 1] == 'G'):
			s[i] = 'G'
			s[i + 1] = 'B'
			i += 2
		else:
			i += 1
	i = 0
print(''.join(s))


(n, t) = map(int, input().split())
queue = list(input())
res = queue.copy()
for _ in range(t):
	for i in range(n - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			(res[i], res[i + 1]) = (res[i + 1], res[i])
	queue = res.copy()
print(''.join(res))


def func(st, n, t):
	for _ in range(t):
		st = st.replace('BG', 'GB')
	return st
(n, t) = map(int, input().split())
st = input()
print(func(st, n, t))


(ppl, time) = map(int, input().split())
kids = list(input())
skip = 1000
for _ in range(time):
	for j in range(ppl - 1):
		if j == skip:
			continue
		skip = 1000
		if kids[j] == 'B' and kids[j + 1] == 'G':
			kids[j] = 'G'
			kids[j + 1] = 'B'
			skip = j + 1
print(''.join(kids))


(n, k) = input().split()
n = int(n)
k = int(k)
x = input()
a = []
for i in range(0, len(x)):
	a.append(x[i])
j = 1
while j <= k:
	h = 0
	while h < len(a) - 1:
		if a[h] == 'B' and a[h + 1] == 'G':
			a[h] = 'G'
			a[h + 1] = 'B'
		else:
			h = h - 1
		h = h + 2
	j = j + 1
c = ''
d = c.join(a)
print(d)


(n, t) = map(int, input().split())
s = input()
ans = []
for i in range(n):
	ans.append(s[i])
for i in range(t):
	k = 1
	while k < n:
		if ans[k - 1] == 'B' and ans[k] == 'G':
			ans[k - 1] = 'G'
			ans[k] = 'B'
			k += 1
		k += 1
for i in range(len(ans)):
	print(ans[i], end='')


kkk = input().split()
n = int(kkk[0])
t = int(kkk[1])
statenew = []
for i in range(n):
	statenew.append(0)
state = list(input())
for i in range(t):
	i = 0
	while i < n - 1:
		baby = state[i]
		babynext = state[i + 1]
		if baby == 'B' and babynext == 'G':
			state[i] = 'G'
			state[i + 1] = 'B'
			i = i + 2
		else:
			i = i + 1
print(''.join(state))


def QueueSorter():
	firstInput = input('').split(' ')
	(n, t) = (int(firstInput[0]), int(firstInput[1]))
	queue = [i for i in input('')]
	for i in range(t):
		index = 0
		for j in range(len(queue) - 1):
			if index >= len(queue) - 1:
				break
			elif queue[index] == 'B' and queue[index + 1] == 'G':
				queue[index] = 'G'
				queue[index + 1] = 'B'
				index += 2
			else:
				index += 1
	for i in queue:
		print(i, end='')
QueueSorter()


(n, t) = map(int, input().split())
child = list(input())
for i in range(t):
	c = 0
	while c < n - 1:
		if child[c] == 'B':
			if child[c + 1] == 'G':
				(child[c], child[c + 1]) = (child[c + 1], child[c])
				c += 1
		c += 1
print(''.join(child))


param = input().split(' ')
n = int(param[0])
t = int(param[1])
queue = list(input().upper())
for i in range(t):
	pos = 0
	while pos < n - 1:
		if queue[pos] == 'B' and queue[pos + 1] == 'G':
			queue[pos] = 'G'
			queue[pos + 1] = 'B'
			pos = pos + 2
		else:
			pos = pos + 1
answer = ''.join(queue)
print(answer)


import sys
(v, s) = sys.stdin.read().strip().split('\n')
(n, t) = map(int, v.split())
for i in range(t):
	s = s.replace('BG', 'GB')
print(s)


nt = input().split()
nt = [int(i) for i in nt]
n = nt[0]
t = nt[1]
que = input()
queue = []
for i in range(n):
	queue.append(que[i])
for i in range(t):
	que = queue[:]
	for k in range(n - 1):
		if que[k] == 'B' and que[k + 1] == 'G':
			queue[k] = 'G'
			queue[k + 1] = 'B'
print(''.join(queue))


(n, t) = list(map(int, input().split()))
line = list(input())
count = 0
while count < t:
	new_line_pos = []
	for i in range(len(line) - 1):
		if line[i] == 'B' and line[i + 1] == 'G':
			new_line_pos.append(i)
	for i in new_line_pos:
		(line[i], line[i + 1]) = (line[i + 1], line[i])
	count += 1
print(''.join(line))


input_string = input()
(n, t) = [int(word) for word in input_string.split(' ')]
queue = [char for char in input()]
timed_queue = queue.copy()
for second in range(1, t + 1, 1):
	temporary_queue = []
	counter = 0
	while counter < len(timed_queue):
		if counter == len(timed_queue) - 1:
			temporary_queue.append(timed_queue[counter])
		elif timed_queue[counter] == 'B' and timed_queue[counter + 1] == 'G':
			temporary_queue.append('G')
			temporary_queue.append('B')
			counter += 1
		else:
			temporary_queue.append(timed_queue[counter])
		counter += 1
	timed_queue = temporary_queue.copy()
new_queue = ''
for char in timed_queue:
	new_queue += char
print(new_queue)


import math
from collections import defaultdict
from collections import Counter
import itertools

def solve(n, k, s):
	l = list(s)
	while k:
		i = 0
		while i <= n - 2:
			if l[i] == 'B' and l[i + 1] == 'G':
				(l[i], l[i + 1]) = (l[i + 1], l[i])
				i += 2
			else:
				i += 1
		k -= 1
	return ''.join(l)
(n, k) = map(int, input().split(' '))
s = input()
print(solve(n, k, s))


(n, t) = [int(p) for p in input().split()]
q = input()
l = []
for i in range(len(q)):
	l.append(q[i])
i = 0
for i in range(t):
	j = 0
	while j < len(l) - 1:
		if l[j] == 'B' and l[j + 1] == 'G':
			(l[j], l[j + 1]) = ('G', 'B')
			j += 2
		elif j < len(l) - 1:
			j += 1
		elif j >= len(l) - 1:
			i += 1
q = ''
for i in range(n):
	q += l[i]
print(q)


(n, t) = map(int, input().split(' '))
s = input()
a = list(s)
b = [t] * n
for y in range(0, t):
	x = 0
	while x < n - 1:
		if a[x] == 'B' and a[x + 1] == 'G':
			b[x] -= 1
			tmp1 = b[x]
			b[x] = b[x + 1]
			b[x + 1] = tmp1
			tmp = a[x]
			a[x] = a[x + 1]
			a[x + 1] = tmp
			x += 1
		x += 1
print(''.join(a))


(x, y) = input().split()
n = int(x)
t = int(y)
s = input()
l = list(s)
b = []
r = ''
for k in range(t):
	for j in range(n):
		if l[j] == 'B':
			b.append(j)
	for i in range(len(b)):
		if b[i] != n - 1:
			temp = l[b[i]]
			l[b[i]] = l[b[i] + 1]
			l[b[i] + 1] = temp
	b.clear()
for i in range(n):
	r += l[i]
print(r)


s = input()
s = s.split()
n = int(s[0])
t = int(s[1])
s = input()
a = []
for i in s:
	a.append(i)
while t:
	t = t - 1
	temp = a[:]
	for i in range(1, n):
		if temp[i - 1] == 'B' and temp[i] == 'G':
			(a[i - 1], a[i]) = (a[i], a[i - 1])
print(''.join(a))


time = input().split()
queue = list(input())
mapB = {}
for i in range(0, len(queue)):
	if queue[i] == 'B':
		mapB['B' + str(i)] = i
for second in range(0, int(time[1])):
	for i in mapB.keys():
		if mapB[i] + 1 == int(time[0]):
			pass
		elif queue[mapB[i] + 1] == 'G':
			(queue[mapB[i]], queue[mapB[i] + 1]) = (queue[mapB[i] + 1], queue[mapB[i]])
			mapB[i] = mapB[i] + 1
print(''.join(queue))


(n, t) = map(int, input().split())
ch = input()
l = []
for i in ch:
	l.append(i)
while t > 0:
	j = 0
	while j < len(l) - 1:
		if l[j] < l[j + 1]:
			(l[j], l[j + 1]) = (l[j + 1], l[j])
			j += 2
		else:
			j += 1
	t -= 1
print(''.join(l))


(no_of_guys, time) = map(int, input().split(' '))
queue = list(input())
pos = []

def position_finder(queue):
	global pos
	for i in range(no_of_guys - 1):
		if queue[i] == 'B' and queue[i + 1] == 'G':
			pos.append(i)

def swap(p):
	t = queue[p]
	queue[p] = queue[p + 1]
	queue[p + 1] = t
while time:
	position_finder(queue)
	for item in pos:
		swap(item)
		pos = []
	time -= 1
print(''.join(queue))


row1 = input().split(' ')
(n, t) = (int(row1[0]), int(row1[1]))
queue = list(input())
for i in range(t):
	j = 0
	while j < len(queue):
		if j == len(queue) - 1:
			j += 1
			continue
		if queue[j] == 'B' and queue[j + 1] == 'G':
			(queue[j], queue[j + 1]) = ('G', 'B')
			j += 1
		j += 1
print(''.join(queue))


def main():
	(n, t) = [int(item) for item in input().split()]
	queue = [person for person in input()]
	for _ in range(t):
		idx = 0
		while idx < len(queue) - 1:
			if queue[idx] == 'B' and queue[idx + 1] == 'G':
				(queue[idx], queue[idx + 1]) = (queue[idx + 1], queue[idx])
				idx += 2
			else:
				idx += 1
	return ''.join(queue)
print(main())