<filename>800/11_05_2021/266B.py
def main():
    a,b = [int(x) for x in input().split()]
    n = input()
    while b: 
        n = n.replace('BG', 'GB')
        b = b - 1
    print(n)

if __name__ == "__main__":
    main()
<filename>800/11_05_2021/266B.py
def main():
    a,b = [int(x) for x in input().split()]
    n = input()
    while b: 
        n = n.replace('BG', 'GB')
        b = b - 1
    print(n)

if __name__ == "__main__":
    main()