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: interview

Starter code:

Solutions:
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 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=input().split()
n=int(n)
t=int(t)

s=input()

for i in range(t):
    s=s.replace("BG","GB")

print(s)


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)


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


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



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

for i in range(t):
    j = 0
    while j < n:
        while j < n and a[j] == 'G':
            j += 1
        while j < n and a[j] == 'B':
            j += 1
        if j < n:
            a[j - 1], a[j] = 'G', 'B'
            j += 1
        
for i in a:
    print(i, end = '')

import math
import sys
#Main function
def cantina():
    datain = []
    queue = []
    
    #Taking input
    for i in range(2):
        datain.append(input().split())

    #Setting time in
    time = int(datain[0][1])

    #Making queue list    
    for i in range(len(datain[1][0])):
        queue.append(datain[1][0][i])

    #Queueswaps based on amount of times
    for i in range(time):
        queueswap(queue)

    #returns queue
    return queue

#Function for swapping
def queueswap(queue):
    swaps = []
    
    #Finds places to swap
    for i in range(len(queue)-1):
        if queue[i] == "B" and queue[i+1] == "G":
            swaps.append(i)
            
    #Swaps the places          
    for i in swaps:
        queue[i] = "G"
        queue[i+1] = "B"
        
    #returns the corrected list
    return queue
    
#Prints the output string
print(''.join(cantina()))


import sys
n, m = list(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)
sys.stdout.write('\n')



n, t = list(map(int, input().split()))
s = input()
for i in range(t):
    s = s.replace("BG","GB")
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)



(n, t) = map(int, input().split())
s = input()
for _ in range(t):
    s=s.replace('BG', "GB")
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)


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

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 = list(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)


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

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)

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)

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

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)


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:]
        else:
            if 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 = 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))

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


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