#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 100;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    long long K;
    cin >> n >> K;
    string s;
    cin >> s;
    string t = s;
    s = s + s + s;
    vector<int> left_border, right_border;
    for(int i = 0; i+1 < s.size(); i++) {
        if(s[i] == s[i+1]) {
            left_border.push_back(i+1);
            right_border.push_back(i);
        }
    }
    if(left_border.size() == 0) {
        cout << t << endl;
        return 0;
    }
    string res(n, 'W');
    for(int i = n; i < n + n; i++) {
        if(s[i] == s[i+1] or s[i] == s[i-1]) {
            res[i-n] = s[i];
            continue;
        }
        auto it = lower_bound(left_border.begin(), left_border.end(), i);
        assert(it != left_border.begin());
        it--;
        int l = *it;
        it = upper_bound(right_border.begin(), right_border.end(), i);
        int r = *it;
        assert(r < s.size());
        int d = min(r-i, i-l);
        if(d <= K) {
            if(r-i < i-l) res[i-n] = s[r];
            else res[i-n] = s[l];
        }
        else {
            if(k&1) {
                if(s[i] == 'W') res[i-n] = 'B';
                else res[i-n] = 'W';
            }
            else {
                res[i-n] = s[i];
            }
        }
    }
    cout << res << endl;
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
#define x first
#define y second
#define mp make_pair

const int MAXN = (int)2e5;
int n, k, res[MAXN + 5];
string s;
vector <pii> g, jedan;

int sz(int l, int r){
	if(r < l)
		return r + 1 + n - l;
	return r - l + 1;
}

bool vr(char c){
	return (c == 'B');
}

char koji(int val){
	if(val)
		return 'B';
	return 'W';
}

inline bool cmp(pii x, pii y){
	return sz(x.x, x.y) > sz(y.x, y.y);
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
cin >> s;
for(int i = 0 ; i < n ; ++i){
	res[i] = vr(s[i]);
}
g.push_back(mp(0, 0));
for(int i = 1 ; i < n ; ++i){
	if(s[i] != s[i - 1]){
		g.push_back(mp(i, i));
		continue;
	}
	g.back().y++;
}
if((int)g.size() > 1 && s[0] == s[(int)s.size() - 1]){
	g[0].x = g.back().x;
	g.pop_back();
}
bool act = 0;
for(int i = 0 ; i < (int)g.size() ; ++i){
	if(g[i].x == g[i].y){
		if(act){
			jedan.back().y++;
		}
		else{
			act = 1;
			jedan.push_back(mp(g[i].x, g[i].y));
		}
	}
	else{
		act = 0;
	}
}
if((int)jedan.size() > 1 && !jedan[0].x && jedan.back().y == n - 1){
	jedan[0].x = jedan.back().x;
	jedan.pop_back();
}
if((int)jedan.size() >= 1 && sz(jedan[0].x, jedan[0].y) == n){
	for(int i = 0 ; i < n ; ++i){
		int x = vr(s[i]) ^ (k & 1);
		cout << koji(x);
	}
	cout << endl;
	return 0;
}
if(!(int)jedan.size()){
	cout << s << endl;
	return 0;
}
vector <pii> v = jedan;
sort(v.begin(), v.end(), cmp);
for(int i = 0 ; i < k ; ++i){
	for(vector <pii>::iterator j = v.begin() ; j != v.end() ; ++j){
		int x = j->x;
		int y = j->y;
		//cout << x << ' ' << y << endl;
		res[x] = res[(x - 1 + n) % n];
		res[y] = res[(y + 1) % n];
	}
	while(!v.empty()){
		int x = v.back().x;
		int y = v.back().y;
		if(sz(x, y) > 2)
			break;
		v.pop_back();
	}
	for(vector <pii>::iterator j = v.begin() ; j != v.end() ; ++j){
		(j->x) = ((j->x) + 1) % n;
		(j->y) = ((j->y) - 1 + n) % n;
	}
}
for(vector <pii>::iterator i = v.begin() ; i != v.end() ; ++i){
	pii o = *i;
	for(int j = o.x ; j != o.y ; j = (j + 1) % n){
		res[j] = (res[(j - 1 + n) % n] ^ 1);
	}
}
for(int i = 0 ; i < n ; ++i){
	cout << koji(res[i]);
}
cout << endl;

return 0;
}


#include <iostream>
#include <queue>
#include <cstring>

using namespace std;

typedef long long ll;
#define x first
#define y second
#define mp make_pair

const int MAXN = (int)2e5;
int n, k, kad[MAXN + 5];
string s;
queue <int> q;

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
cin >> s;
memset(kad, -1, sizeof(kad));
for(int i = 0 ; i < n ; ++i){
	int prev = (i - 1 + n) % n;
	int nxt = (i + 1) % n;
	if(s[i] == s[prev] || s[i] == s[nxt]){
		q.push(i);
		kad[i] = 0;
	}
}
while(!q.empty()){
	int o = q.front();
	q.pop();
	int prev = (o - 1 + n) % n;
	int nxt = (o + 1) % n;
	if(kad[prev] == -1){
		kad[prev] = kad[o] + 1;
		q.push(prev);
	}
	if(kad[nxt] == -1){
		kad[nxt] = kad[o] + 1;
		q.push(nxt);
	}
}
for(int i = 0 ; i < n ; ++i){
	if(kad[i] == -1){
		cout << s[i];
	}
	else if(kad[i] > k){
		cout << (k & 1 ? (char)('W' + 'B' - s[i]) : s[i]);
	}
	else{
		cout << (kad[i] & 1 ? (char)('W' + 'B' - s[i]) : s[i]);
	}
}
cout << endl;

return 0;
}


#include <iostream>
#include <queue>

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;
#define x first
#define y second
#define mp make_pair

const int MAXN = (int)2e5;
int n, k;
string s;
queue <pii> q;
bool bio[MAXN + 5];

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
cin >> s;
for(int i = 0 ; i < n ; ++i){
	int prev = (i - 1 + n) % n;
	int nxt = (i + 1) % n;
	if(s[i] == s[prev] || s[i] == s[nxt]){
		q.push(mp(i, 0));
		bio[i] = 1;
	}
}
while(!q.empty()){
	pii o = q.front();
	q.pop();
	//cout << o.x << ' ' << o.y << endl;
	if(o.y > k)
		continue;
	int prev = (o.x - 1 + n) % n;
	int nxt = (o.x + 1) % n;
	if(!bio[prev]){
		s[prev] = s[o.x];
		bio[prev] = 1;
		q.push(mp(prev, o.y + 1));
	}
	if(!bio[nxt]){
		s[nxt] = s[o.x];
		bio[nxt] = 1;
		q.push(mp(nxt, o.y + 1));
	}
}
for(int i = 0 ; i < n ; ++i){
	if(bio[i]){
		cout << s[i];
	}
	else{
		cout << (k & 1 ? (char)('W' + 'B' - s[i]) : s[i]);
	}
}
cout << endl;

return 0;
}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))
#define MX 200005

int N,K;
char str[MX],out[MX];
int posL[MX],posR[MX];
int posSz;
int stId=-1,enId=-1;

void solve(char *s)
{
    int i,L,j;
    bool flg=0;
    int p1,p2;
    for(i=0;i<N;i++) out[i]=s[i];

    for(i=0; i<posSz; i++)
    {
        if(i+1<posSz)
        {
            L=posL[i+1]-posR[i]-1;
            p1=posR[i]+1,p2=posL[i+1]-1;
        }
        else
        {
            L=N-posR[i]-1;
            p1=posR[i]+1,p2=N-1;
        }
        if(L>=1)
        {
            flg=1;
            int op=(L+1)/2;
            op=MIN(op,K);
            for(j=1; j<=op; j++)
            {
                int l=(p1-1+N)%N,r=(p1+1)%N;
                if(j%2  && s[p1]!=out[l] && s[p1]!=out[r])
                {
                    if(s[p1]=='B')
                        s[p1]='W';
                    else
                        s[p1]='B';
                }
                p1++;
                if(p2<p1)
                    break;

                l=(p2-1+N)%N,r=(p2+1)%N;

                if(j%2 && s[p2]!=out[l] && s[p2]!=out[r])
                {
                    if(s[p2]=='B')
                        s[p2]='W';
                    else
                        s[p2]='B';
                }
                p2--;
            }

            if(p1<p2)
            {
                for(j=p1; j<=p2; j++)
                {
                    if(op%2)
                    {
                        if(s[j]=='B')
                            s[j]='W';
                        else
                            s[j]='B';
                    }
                }
            }
        }
    }

    for(i=stId; i<=enId; i++)
        printf("%c",s[i]);

    for(i=0; i<stId; i++)
        printf("%c",s[i]);
    cout<<endl;
}

void go(char *s,bool flg)
{
    // calculating continuous segment
    int i;
    posSz=0;
    for(i=0; i<N-1; i++)
    {
        if(s[i]==s[i+1])
        {
            posL[posSz]=i;
            while(1)
            {
                if(i==N-1)
                {
                    posR[posSz]=i;
                    posSz++;
                    break;
                }

                if(s[i]==s[i+1])
                    i++;
                else
                {
                    posR[posSz]=i;
                    posSz++;
                    break;
                }
            }
        }
    }

    if(flg)
        solve(s);
}

void drag_first_to_last(int st,int en)
{
    int len=0,i;
    char s[MX];
    for(i=en+1; i<N; i++)
        s[len++]=str[i];

    stId=len;
    for(i=st; i<=en; i++)
        s[len++]=str[i];
    enId=len-1;
    s[len]='\0';

    posSz=0;
    //cout<<"S in drag_first_to_last: "<<s<<endl;
    go(s,1);
}

void solve_for_all_alternate(char *s)
{
    int i,j;
    for(i=0; i<N; i++)
    {
        if(K%2)
        {
            // alter
            if(s[i]=='W')
                s[i]='B';
            else
                s[i]='W';
        }
    }
    cout<<s<<endl;
}

int main()
{
    cin>>N>>K;
    cin>>str;
    //cout<<str<<endl;
    int i,j,l,m,r,cnt=0,mx=0;

    go(str,0);

    //cout<<posSz<<endl;
    //for(i=0; i<posSz; i++)
        //cout<<"L: "<<posL[i]<<"  R: "<<posR[i]<<endl;
    //drag_first_to_last(0,2);

    if(!posSz)
    {
        if(str[0]!=str[N-1])
            solve_for_all_alternate(str);
        else
        {
            drag_first_to_last(0,N-2);
            //cout<<"Sz: "<<posSz<<endl;
            //cout<<"St: "<<stId<<"  en: "<<enId<<endl;
        }
    }
    else
    {
        if(posL[0]!=0)
        {
           // cout<<"120"<<endl;
            drag_first_to_last(0,posL[0]-1);
        }
        else
        {
            //cout<<"came in else"<<endl;
            stId=0,enId=N-1;
            go(str,1);
        }
    }

    return 0;
}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
}ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0;i<N;i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r) cnt++;
        else
        {
            if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0) cout<<str<<endl;
        else
        {
            for(i=0;i<N;i++)
            {
                if(str[i]=='B') out[i]='W';
                else out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);
    //cout<<"MN: "<<mn<<endl;
    for(i=0;i<sz;i++)
    {
        //cout<<"ball"<<endl;
        l=ar[i].st,r=ar[i].en;
        //cout<<l<<"  "<<r<<endl;
        for(j=1;j<=mn;j++)
        {
            if(l>r) break;

            if(j%2)
            {
                if(str[l]=='B') out[l]='W';
                else out[l]='B';
                vis[l]=true;
            }

            if(l==r)
            {
                l++;
                continue;
            }

            if(j%2)
            {
                if(str[r]=='B') out[r]='W';
                else out[r]='B';

                vis[r]=true;
            }

            l++,r--;
        }

        if(l<=r)
        {
            for(int x=l;x<=r;x++)
            {
                if(mn%2)
                {
                    if(str[x]=='B') out[x]='W';
                    else out[x]='B';
                    vis[x]=true;
                }
            }
        }
    }
    for(i=0;i<N;i++)
    {
        if(!vis[i]) out[i]=str[i];
    }
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
} ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0; i<N; i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r)
            cnt++;
        else
        {
            if(cnt)
                ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt)
        ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0)
            cout<<str<<endl;
        else
        {
            for(i=0; i<N; i++)
            {
                if(str[i]=='B')
                    out[i]='W';
                else
                    out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);
    //cout<<"MN: "<<mn<<endl;

    if(ar[0].st==0 && ar[sz-1].en==N-1)
    {
        it=ar[0].en - ar[0].st + 1 + ar[sz-1].en - ar[sz-1].st + 1;
        it=(it+1)/2;
        mn=MIN(it,K);
       // cout<<"mn: "<<mn<<endl;
       // cout<<"ball"<<endl;
        l=ar[sz-1].st,r=ar[0].en;

        bool flg=0;
        for(j=1; j<=mn; j++)
        {
            //cout<<"out: "<<out<<endl;
           // cout<<"l: "<<l<<"  r: "<<r<<endl;
            if(vis[l] && vis[r])
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }
            else out[l]=str[l],vis[l]=true;

            if(l==r)
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }
            else out[r]=str[r],vis[r]=true;

           // cout<<"l: "<<l<<" ch: "<<out[l]<<"  r: "<<r<<"  ch: "<<out[r]<<endl;
            l=(l+1)%N,r=(r-1+N)%N;
           // cout<<"after changing l: "<<l<<"  r: "<<r<<endl;
        }

        if(!flg)
        {

            int x=(l)%N;
            while(1)
            {
                if(vis[x]) break;
                //cout<<"x: "<<x<<endl;

                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
                else if(mn%2==0 && !vis[x]) out[x]=str[x],vis[x]=true;
                x=(x+1)%N;
            }
        }
    }

    //cout<<"got out: "<<out<<endl;
    //for(int h=0;h<N;h++) cout<<out[h];
    //cout<<endl;
    for(i=0; i<sz; i++)
    {
        //cout<<"ball"<<endl;
        l=ar[i].st,r=ar[i].en;
        //cout<<l<<"  "<<r<<endl;
        if(vis[l] && vis[r]) continue;
        for(j=1; j<=mn; j++)
        {
            if(l>r)
                break;

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }

            if(l==r)
            {
                l++;
                continue;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }

            l++,r--;
        }

        if(l<=r)
        {
            for(int x=l; x<=r; x++)
            {
                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
            }
        }
    }
    for(i=0; i<N; i++)
    {
        if(!vis[i])
            out[i]=str[i];
    }
    //cout<<"ANS: "<<out<<endl;
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
}ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0;i<N;i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r) cnt++;
        else
        {
            if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0) cout<<str<<endl;
        else
        {
            for(i=0;i<N;i++)
            {
                if(str[i]=='B') out[i]='W';
                else out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);

    for(i=0;i<sz;i++)
    {
        l=ar[i].st,r=ar[i].en;
        for(j=1;j<=mn;j++)
        {
            if(l>r) break;

            if(j%2)
            {
                if(str[l]=='B') out[l]='W';
                else out[l]='B';
                vis[l]=true;
            }

            if(l==r) continue;

            if(j%2)
            {
                if(str[r]=='B') out[r]='W';
                else out[r]='B';

                vis[r]=true;
            }

            l++,r--;
        }
    }
    for(i=0;i<N;i++)
    {
        if(!vis[i]) out[i]=str[i];
    }
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
} ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0; i<N; i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r)
            cnt++;
        else
        {
            if(cnt)
                ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt)
        ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0)
            cout<<str<<endl;
        else
        {
            for(i=0; i<N; i++)
            {
                if(str[i]=='B')
                    out[i]='W';
                else
                    out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);
    //cout<<"MN: "<<mn<<endl;

    if(ar[0].st==0 && ar[sz-1].en==N-1)
    {
        it=ar[0].en - ar[0].st + 1 + ar[sz-1].en - ar[sz-1].st + 1;
        it=(it+1)/2;
        mn=MIN(it,K);
       // cout<<"mn: "<<mn<<endl;
       // cout<<"ball"<<endl;
        l=ar[sz-1].st,r=ar[0].en;

        bool flg=0;
        for(j=1; j<=mn; j++)
        {
            //cout<<"out: "<<out<<endl;
           // cout<<"l: "<<l<<"  r: "<<r<<endl;
            if(vis[l] && vis[r])
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }
            else out[l]=str[l],vis[l]=true;

            if(l==r)
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }
            else out[r]=str[r],vis[r]=true;

           // cout<<"l: "<<l<<" ch: "<<out[l]<<"  r: "<<r<<"  ch: "<<out[r]<<endl;
            l=(l+1)%N,r=(r-1+N)%N;
           // cout<<"after changing l: "<<l<<"  r: "<<r<<endl;
        }

        if(!flg)
        {

            int x=(l)%N;
            while(1)
            {
                if(vis[x]) break;
                //cout<<"x: "<<x<<endl;

                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
                else if(mn%2==0 && !vis[x]) out[x]=str[x],vis[x]=true;
                x=(x+1)%N;
            }
        }
    }

    //cout<<"got out: "<<out<<endl;
    //for(int h=0;h<N;h++) cout<<out[h];
    //cout<<endl;
    for(i=0; i<sz; i++)
    {
        //cout<<"ball"<<endl;
        l=ar[i].st,r=ar[i].en;
        //cout<<l<<"  "<<r<<endl;
        if(vis[l] && vis[r]) continue;
        for(j=1; j<=mn; j++)
        {
            if(l>r)
                break;

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }
            else out[l]=str[l],vis[l]=true;

            if(l==r)
            {
                l++;
                continue;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }
            else out[r]=str[r],vis[r]=true;

            l++,r--;
        }

        if(l<=r)
        {
            for(int x=l; x<=r; x++)
            {
                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
                else if(mn%2==0 && !vis[x]) out[x]=str[x],vis[x]=true;
            }
        }
    }
    for(i=0; i<N; i++)
    {
        if(!vis[i])
            out[i]=str[i];
    }
    //cout<<"ANS: "<<out<<endl;
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
}ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0;i<N;i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r) cnt++;
        else
        {
            if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt) ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0) cout<<str<<endl;
        else
        {
            for(i=0;i<N;i++)
            {
                if(str[i]=='B') out[i]='W';
                else out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);
    //cout<<"MN: "<<mn<<endl;
    for(i=0;i<sz;i++)
    {
        //cout<<"ball"<<endl;
        l=ar[i].st,r=ar[i].en;
        //cout<<l<<"  "<<r<<endl;
        for(j=1;j<=mn;j++)
        {
            if(l>r) break;

            if(j%2)
            {
                if(str[l]=='B') out[l]='W';
                else out[l]='B';
                vis[l]=true;
            }

            if(l==r)
            {
                l++;
                continue;
            }

            if(j%2)
            {
                if(str[r]=='B') out[r]='W';
                else out[r]='B';

                vis[r]=true;
            }

            l++,r--;
        }

        if(l==r)
        {
            if(mn%2)
            {
                if(str[l]=='B') out[l]='W';
                else out[l]='B';
                vis[l]=true;
            }
        }
    }
    for(i=0;i<N;i++)
    {
        if(!vis[i]) out[i]=str[i];
    }
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


#include<iostream>
#include<stdio.h>
using namespace std;

#define MAX(a, b) ((a > b) ? (a) : (b))
#define MIN(a, b) ((a < b) ? (a) : (b))

int N,K;
char str[200005],out[200005];
struct
{
    int st,en;
} ar[200005];
int sz;

bool vis[200005];

int main()
{
    cin>>N>>K;
    cin>>str;
    int i,j,l,m,r,cnt=0,mx=0;

    for(i=0; i<N; i++)
    {
        m=i,l=(i-1+N)%N,r=(i+1)%N;

        if(str[m]!=str[l] && str[m]!=str[r] && l!=r)
            cnt++;
        else
        {
            if(cnt)
                ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;
            cnt=0;
        }
    }
    if(cnt)
        ar[sz].st=i-cnt,ar[sz].en=i-1,sz++,mx=MAX(mx,cnt),cnt=0;

    if(!sz)
    {
        cout<<str<<endl;
        return 0;
    }

    if(sz==1 && ar[0].st==0 && ar[0].en==N-1)
    {
        if(K%2==0)
            cout<<str<<endl;
        else
        {
            for(i=0; i<N; i++)
            {
                if(str[i]=='B')
                    out[i]='W';
                else
                    out[i]='B';
            }
            cout<<out<<endl;
        }
        return 0;
    }

    int it=(mx+1)/2;
    int mn=MIN(it,K);
    //cout<<"MN: "<<mn<<endl;

    if(ar[0].st==0 && ar[sz-1].en==N-1)
    {
        it=ar[0].en - ar[0].st + 1 + ar[sz-1].en - ar[sz-1].st + 1;
        it=(it+1)/2;
        mn=MIN(it,K);
       // cout<<"ball"<<endl;
        l=ar[sz-1].st,r=ar[0].en;

        bool flg=0;
        for(j=1; j<=mn; j++)
        {
            //cout<<"out: "<<out<<endl;
            //cout<<"l: "<<l<<"  r: "<<r<<endl;
            if(vis[l] && vis[r])
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }
            else out[l]=str[l],vis[l]=true;

            if(l==r)
            {
                flg=1;
                break;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }
            else out[r]=str[r],vis[r]=true;

            l=(l+1)%N,r=(r-1+N)%N;
            //cout<<"after changing l: "<<l<<"  r: "<<r<<endl;
        }

        if(!flg)
        {

            int x=(l)%N;
            while(1)
            {
                if(vis[x]) break;
                //cout<<"x: "<<x<<endl;

                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
                x=(x+1)%N;
            }
        }
    }

    //cout<<"got out: "<<out<<endl;
    //for(int h=0;h<N;h++) cout<<out[h];
    //cout<<endl;
    for(i=0; i<sz; i++)
    {
        //cout<<"ball"<<endl;
        l=ar[i].st,r=ar[i].en;
        //cout<<l<<"  "<<r<<endl;
        if(vis[l] && vis[r]) continue;
        for(j=1; j<=mn; j++)
        {
            if(l>r)
                break;

            if(j%2)
            {
                if(str[l]=='B')
                    out[l]='W';
                else
                    out[l]='B';
                vis[l]=true;
            }

            if(l==r)
            {
                l++;
                continue;
            }

            if(j%2)
            {
                if(str[r]=='B')
                    out[r]='W';
                else
                    out[r]='B';

                vis[r]=true;
            }

            l++,r--;
        }

        if(l<=r)
        {
            for(int x=l; x<=r; x++)
            {
                if(mn%2 && !vis[x])
                {
                    if(str[x]=='B')
                        out[x]='W';
                    else
                        out[x]='B';
                    vis[x]=true;
                }
            }
        }
    }
    for(i=0; i<N; i++)
    {
        if(!vis[i])
            out[i]=str[i];
    }
    //cout<<"ANS: "<<out<<endl;
    cout<<out<<endl;
    //cout<<"sz: "<<sz<<" st: "<<ar[0].st<<" en: "<<ar[0].en<<endl;
    return 0;

}


/**Author:jsonfive**/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
const int maxn = 2e5+5;
char str[maxn];
int col[maxn];
int L[maxn],R[maxn];
signed main()
{
    int n,k;
    cin>>n>>k;
    cin>>(str);
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        if(col[i])
        {
            continue;
        }
        int l = i;
        int r = i;
        while(l>i-n&&str[(l+n)%n]==str[(l-1+n)%n])
        {
            l--;
        }
        while(r<i+n&&str[(r+n)%n]==str[(r+1+n)%n])
        {
            r++;
        }
        if(r-l+1>=2)
        {
            L[cnt]=l;
            R[cnt]=r;
            cnt++;
            int c = 0;
            if(str[i]=='W')
                c = 1;
            else c = -1;
            for(int j=l;j<=r;j++)
            {
                col[(j+n)%n]=c;
            }
        }
    }
    if(cnt==0)
    {
        k%=2;
        if(k)
        {
            for(int i=0;i<n;i++)
            {
                if(str[i]=='W')str[i]='B';
                else str[i]='W';
            }
        }
        cout<<str;
    }
    else
    {
        while(k--)
        {
            int sum = 0;
            for(int i=0;i<cnt;i++)
            {
                if(col[(L[i]-1+n)%n]==0)
                {
                    col[(L[i]-1+n)%n]=col[(L[i]+n)%n];
                    L[i]--;
                    sum++;
                }
                if(col[(R[i]+1+n)%n]==0)
                {
                    col[(R[i]+1+n)%n]=col[(R[i]+n)%n];
                    R[i]++;
                    sum++;
                }
            }
            if(sum==0)break;
        }
        for(int i=R[0]+1;i<R[0]+1+n;i++)
        {
            if(col[(i+n)%n])
            {
                continue;
            }
            else
            {
                col[(i+n)%n]=-col[(i-1+n)%n];
            }
        }
        for(int i=0;i<n;i++)
        {
            if(col[i]==1)
                str[i]='W';
            else str[i]='B';
        }
        cout<<str;
    }
}


/**Author:jsonfive**/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
const int maxn = 2e5+5;
char str[maxn];
char tmp[maxn];
signed main()
{
    int n,k;
    cin>>n>>k;
    cin>>(str);
    while(k--)
    {
        int cnt = 0;
        for(int i=0;i<n;i++)
        {
            int l = (i-1+n)%n;
            int r = (i+1)%n;
            if(str[l]==str[r]&&str[i]!=str[l])
            {
                tmp[i]=str[l];
                cnt++;
            }
            else tmp[i]=str[i];
        }
        swap(str,tmp);
        if(cnt==0)break;
        if(cnt==n)
        {
            k%=2;
        }
    }
    cout<<str<<endl;
}


/**Author:jsonfive**/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
const int maxn = 1e5+5;
char str[maxn];
char tmp[maxn];
signed main()
{
    int n,k;
    cin>>n>>k;
    cin>>(str);
    while(k--)
    {
        int cnt = 0;
        for(int i=0;i<n;i++)
        {
            int l = (i-1+n)%n;
            int r = (i+1)%n;
            if(str[l]==str[r]&&str[i]!=str[l])
            {
                tmp[i]=str[l];
                cnt++;
            }
            else tmp[i]=str[i];
        }
        swap(str,tmp);
        if(cnt==0)break;
        if(cnt==n)
        {
            k%=2;
        }
    }
    cout<<str<<endl;
}


/**Author:jsonfive**/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<unordered_map>
#include<unordered_set>
#define inf 0x3f3f3f3f
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define int long long
using namespace std;
const int maxn = 2e5+5;
char str[maxn];
int col[maxn];
int L[maxn],R[maxn];
signed main()
{
    int n,k;
    cin>>n>>k;
    cin>>(str);
    int cnt = 0;
    for(int i=0;i<n;i++)
    {
        if(col[i])
        {
            continue;
        }
        int l = i;
        int r = i;
        while(str[(l+n)%n]==str[(l-1+n)%n])
        {
            l--;
        }
        while(str[(r+n)%n]==str[(r+1+n)%n])
        {
            r++;
        }
        if(r-l+1>=2)
        {
            L[cnt]=l;
            R[cnt]=r;
            cnt++;
            int c = 0;
            if(str[i]=='W')
                c = 1;
            else c = -1;
            for(int j=l;j<=r;j++)
            {
                col[(j+n)%n]=c;
            }
        }
    }
    if(cnt==0)
    {
        k%=2;
        if(k)
        {
            for(int i=0;i<n;i++)
            {
                if(str[i]=='W')str[i]='B';
                else str[i]='W';
            }
        }
        cout<<str;
    }
    else
    {
        while(k--)
        {
            int sum = 0;
            for(int i=0;i<cnt;i++)
            {
                if(col[(L[i]-1+n)%n]==0)
                {
                    col[(L[i]-1+n)%n]=col[(L[i]+n)%n];
                    L[i]--;
                    sum++;
                }
                if(col[(R[i]+1+n)%n]==0)
                {
                    col[(R[i]+1+n)%n]=col[(R[i]+n)%n];
                    R[i]++;
                    sum++;
                }
            }
            if(sum==0)break;
        }
        for(int i=R[0]+1;i<R[0]+1+n;i++)
        {
            if(col[(i+n)%n])
            {
                continue;
            }
            else
            {
                col[(i+n)%n]=-col[(i-1+n)%n];
            }
        }
        for(int i=0;i<n;i++)
        {
            if(col[i]==1)
                str[i]='W';
            else str[i]='B';
        }
        cout<<str;
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    vector<int> v;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[i]||s[i]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    if(!v.size())
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
    }
    int len=v.size();
    int las=v[len-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else l[i]=las;
    las=v[1];
    for(int i=n;i>0;i--)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
vector<int> v;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[i]||s[i]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    int len=v.size();
    if(!len)
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
        return 0;
    }
    int las=v[len-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else l[i]=las;
    las=v[1];
    for(int i=n;i>0;i--)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    vector<int> v;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[r]||s[l]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    if(!v.size())
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
    }
    int las=v[v.size()-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else  l[i]=las;
    las=v[1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'R';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    vector<int> v;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[i]||s[i]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    if(!v.size())
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
    }
    int las=v[v.size()-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else l[i]=las;
    las=v[1];
    for(int i=n;i>0;i--)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
vector<int> v;
int main()
{
   // freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[i]||s[i]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    int len=v.size();
    if(!len)
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
    }
    int las=v[len-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else l[i]=las;
    las=v[1];
    for(int i=n;i>0;i--)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool vis[200010];
int l[200010],r[200010];
string ans;
int main()
{
   // freopen("in.txt","r",stdin);
    int n,m;
    string s;
    cin>>n>>m>>s;
    s="."+s;
    vector<int> v;
    for(int i=1;i<=n;i++)
    {
        int l=(i+n-2)%n+1,r=i%n+1;
        if(s[l]==s[r]||s[l]==s[r])
        {
            v.push_back(i);
            vis[i]=1;
        }
    }
    if(!v.size())
    {
        for(int i=1;i<=n;i++)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        for(int i=1;i<=n;i++)
            cout<<ans[i];
        cout<<endl;
    }
    int las=v[v.size()-1];
    for(int i=1;i<=n;i++)
        if(vis[i])las=i;
        else  l[i]=las;
    las=v[1];
    for(int i=n;i>0;i--)
        if(vis[i])las=i;
        else r[i]=las;
    for(int i=1;i<=n;i++)
    {
        if(vis[i]){
            ans[i]=s[i];
            continue;
        }
        int ld=(i-l[i]+n)%n,rd=(r[i]-i+n)%n;
        if(min(ld,rd)>m)
            ans[i]=(s[i]=='W'^(m&1))?'W':'B';
        else
            ans[i]=(ld<rd)?s[l[i]]:s[r[i]];
    }
    for(int i=1;i<=n;i++)
        cout<<ans[i];
    cout<<endl;
    return 0;
}


// TEMPLATE --------------------------------------------------
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

// TEMPLATE --------------------------------------------------

#define N 300050
#define int long long

int n, m, q, k, v[N];

pii TT;

int ans;

int qtd = 0, fixo[N], ini[N];

string s;

vector<int> fixos;

int dist(int a, int b)
{
	if(a > b) swap(a, b);

	return min(b - a, n - a + b);
}

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(0);

	cin>>n>>k;

	cin>>s;

	for(int i = 0; i < n; i++)
	{
		v[i] = (s[i] == 'W' ? 0 : 1);

		ini[i] = v[i];
	}

	for(int i = 0; i < n; i++)
	{
		int x = v[i];

		fixo[i] = 1;

		if(v[(i - 1 + n)%n] != v[i] and v[(i + 1)%n] != v[i]) fixo[i] = 0;

		else fixos.pb(i);//, cout<<"fixo "<<i<<"\n";
	}

	for(int i = 0; i < n; i++)
	{
		if(fixo[i])
		{
			cout<<(v[i] ? "B" : "W");

			continue;
		}

		if(fixos.empty())
		{
			v[i] = v[i] ^ (k % 2);

			cout<<(v[i] ? "B" : "W");

			continue;
		}

		int j = lower_bound(all(fixos), i) - fixos.begin();

		if(lower_bound(all(fixos), i) == fixos.end())
		{
			j = *fixos.begin();
		}

		int jj = (j - 1 + sz(fixos)) % sz(fixos);

		int pj = fixos[j], pjj = fixos[jj];

		int d1 = dist(i, pj), d2 = dist(pjj, i);

		int dmin = min(d1, d2);

		//cout<<i<<" "<<pj<<" "<<pjj<<" "<<dmin<<" "<<k<<"\n";

		if(dmin <= k)
		{
			if(d1 == d2 and ini[pj] != ini[pjj]) v[i] = (v[i]) ^ (k % 2), cout<<"oi\n";

			else
			{
				if(d1 < d2) v[i] = ini[pj];

				else v[i] = ini[pjj];
			}
		}

		else v[i] = v[i] ^ (k%2);//, cout<<"alo "<<i<<"\n";

		cout<<(v[i] ? "B" : "W");
	}

	cout<<"\n";
}


// TEMPLATE --------------------------------------------------
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

// TEMPLATE --------------------------------------------------

#define N 300050
#define int long long

int n, m, q, k, v[N];

pii TT;

int ans;

int qtd = 0, fixo[N], ini[N];

string s;

vector<int> fixos;

int dist(int a, int b)
{
	if(a > b) swap(a, b);

	return min(b - a, n + a - b);
}

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(0);

	cin>>n>>k;

	cin>>s;

	for(int i = 0; i < n; i++)
	{
		v[i] = (s[i] == 'W' ? 0 : 1);

		ini[i] = v[i];
	}

	for(int i = 0; i < n; i++)
	{
		int x = v[i];

		fixo[i] = 1;

		if(v[(i - 1 + n)%n] != v[i] and v[(i + 1)%n] != v[i]) fixo[i] = 0;

		else fixos.pb(i);//, cout<<"fixo "<<i<<"\n";
	}

	for(int i = 0; i < n; i++)
	{
		if(fixo[i])
		{
			cout<<(v[i] ? "B" : "W");

			continue;
		}

		if(fixos.empty())
		{
			v[i] = v[i] ^ (k % 2);

			cout<<(v[i] ? "B" : "W");

			continue;
		}

		int j = lower_bound(all(fixos), i) - fixos.begin();

		if(lower_bound(all(fixos), i) == fixos.end())
		{
			j = 0;
		}

		int jj = (j - 1 + sz(fixos)) % sz(fixos);

		int pj = fixos[j], pjj = fixos[jj];

		int d1 = dist(i, pj), d2 = dist(pjj, i);

		int dmin = min(d1, d2);

		//cout<<i<<" "<<pj<<" "<<pjj<<" "<<dmin<<" "<<k<<"\n";

		if(dmin <= k)
		{
			if(d1 == d2 and ini[pj] != ini[pjj]) v[i] = (v[i]) ^ (k % 2), cout<<"oi\n";

			else
			{
				if(d1 < d2) v[i] = ini[pj];

				else v[i] = ini[pjj];
			}
		}

		else v[i] = v[i] ^ (k%2);//, cout<<"alo "<<i<<"\n";

		cout<<(v[i] ? "B" : "W");
	}

	cout<<"\n";
}


// TEMPLATE --------------------------------------------------
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<class T1, class T2>
istream &operator>>(istream &in, pair<T1, T2> &P){
	in >> P.first >> P.second;
	return in;
}
template<class T1, class T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &P){
	out << "(" << P.first << ", " << P.second << ")";
	return out;
}
template<class T>
istream &operator>>(istream &in, vector<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const vector<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}
template<class T>
istream &operator>>(istream &in, deque<T> &arr){
	for(auto &x: arr) in >> x;
	return in;
}
template<class T>
ostream &operator<<(ostream &out, const deque<T> &arr){
	for(auto &x: arr) out << x << ' '; cout << "\n";
	return out;
}

// TEMPLATE --------------------------------------------------

#define N 300050
#define int long long

int n, m, q, k, v[N];

pii TT;

int ans;

int qtd = 0, fixo[N], ini[N];

string s;

vector<int> fixos;

int dist(int a, int b)
{
	if(a > b) swap(a, b);

	return min(b - a, n - a + b);
}

int32_t main()
{
	ios::sync_with_stdio(false); cin.tie(0);

	cin>>n>>k;

	cin>>s;

	for(int i = 0; i < n; i++)
	{
		v[i] = (s[i] == 'W' ? 0 : 1);

		ini[i] = v[i];
	}

	for(int i = 0; i < n; i++)
	{
		int x = v[i];

		fixo[i] = 1;

		if(v[(i - 1 + n)%n] != v[i] and v[(i + 1)%n] != v[i]) fixo[i] = 0;

		else fixos.pb(i);//, cout<<"fixo "<<i<<"\n";
	}

	for(int i = 0; i < n; i++)
	{
		if(fixo[i])
		{
			cout<<(v[i] ? "B" : "W");

			continue;
		}

		if(fixos.empty())
		{
			v[i] = v[i] ^ (k % 2);

			cout<<(v[i] ? "B" : "W");

			continue;
		}

		int j = lower_bound(all(fixos), i) - fixos.begin();

		if(lower_bound(all(fixos), i) == fixos.end())
		{
			j = 0;
		}

		int jj = (j - 1 + sz(fixos)) % sz(fixos);

		int pj = fixos[j], pjj = fixos[jj];

		int d1 = dist(i, pj), d2 = dist(pjj, i);

		int dmin = min(d1, d2);

		//cout<<i<<" "<<pj<<" "<<pjj<<" "<<dmin<<" "<<k<<"\n";

		if(dmin <= k)
		{
			if(d1 == d2 and ini[pj] != ini[pjj]) v[i] = (v[i]) ^ (k % 2), cout<<"oi\n";

			else
			{
				if(d1 < d2) v[i] = ini[pj];

				else v[i] = ini[pjj];
			}
		}

		else v[i] = v[i] ^ (k%2);//, cout<<"alo "<<i<<"\n";

		cout<<(v[i] ? "B" : "W");
	}

	cout<<"\n";
}


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double

#define pb push_back
#define ins insert
#define er erase

#define f(i, a, b) for (int i = a; i < b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define cadd(a, b) a = add(a, b)
#define csub(a, b) a = subt(a, b)
#define cmul(a, b) a = mult(a, b)
#define mem(a, b) memset(a, b, sizeof(a))

#define vi vector<int>
#define vst vector<string>
#define vpii vector<pii>

#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define ff first
#define ss second

#define bs bitset
#define bpc(a) __builtin_popcount(a)

#define mii map<int, int>
#define umii unordered_map<int, int>

#define si set<int>
#define usi unordered_set<int>
#define spii set<pii>

#define pqi priority_queue<int>
#define pqpii priority_queue<pii>

#define dbg(a, st, end)                   \
    f(i, st, end + 1) cerr << a[i] << sp; \
    cerr << nl;
#define pnt(a, st, end)                   \
    f(i, st, end + 1) cout << a[i] << sp; \
    cout << nl;
#define dbgc(a)          \
    for (auto y : a)     \
        cerr << y << sp; \
    cerr << nl;
#define dbgm(a)                            \
    for (auto y : a)                       \
        cerr << y.ff << "," << y.ss << sp; \
    cerr << nl;

#define trace(a) cerr << a << nl;
#define trace2(a, b) cerr << a << sp << b << nl;
#define trace3(a, b, c) cerr << a << sp << b << sp << c << nl;
#define trace4(a, b, c, d) cerr << a << sp << b << sp << c << sp << d << nl;

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
#define sp " "

using namespace std;
using namespace std::chrono;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ok order_of_key
#define fo find_by_order

//ll md = 1000000007;
ld pi = 3.141592653;
ll md = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}

ll modinv(ll n)
{
    return pwmd(n, md - 2);
}

ll my_ceil(ll a, ll b)
{
    if (a % b == 0)
        return a / b;
    return a / b + 1;
}

ll nc2(ll n)
{
    return (1ll * n * (n - 1)) / 2;
}

ll nsum(ll n)
{
    return (1ll * n * (n + 1)) / 2;
}

int my_log(ll n, int b)
{
    ll i = 1;
    int ans = 0;
    while (1)
    {
        if (i > n / b)
            break;
        i *= b;
        ans++;
    }
    return ans;
}

inline int nc()
{
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
    int ret = 0;
    bool f = 0;
    char ch = nc();
    while (ch > '9' || ch < '0')
        f ^= ch == '-', ch = nc();
    while (ch <= '9' && ch >= '0')
        ret = ret * 10 + ch - '0', ch = nc();
    return f ? -ret : ret;
}

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

inline ll add(ll a, ll b) { return (((a >= md) ? a % md : a) + ((b >= md) ? b % md : b) + md) % md; }
inline ll subt(ll a, ll b) { return (a - b + md) % md; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= md) ? a % md : a) * ((b >= md) ? b % md : b)) % md; }

inline int manhatten(pii p1, pii p2) { return abs(p1.ff - p2.ff) + abs(p1.ss - p2.ss); }

inline bool kthbit(ll n, int k) { return (n >> k) & 1; }
inline ll setkthbit(ll n, int k) { return n | (1ll << k); }
inline ll unsetkthbit(ll n, int k) { return n & ~(1ll << k); }
inline ll flipkthbit(ll n, int k) { return n ^ (1ll << k); }

//LET'S PLAY THE GAME!!

/*

CHECK FOR N=1, N=2, etc;
REMOVE DEBUG STATEMENTS
CHECK FOR DUPLICATES (SET -> MULTISET)
CHECK FOR OVERFLOW
CLEAR EVERYTHING BEFORE EVERY TESTCASE
DON'T MISTAKE ROOT FOR LEAF
DON'T ALWAYS IGNORE THE BRUTE FORCE SOLUTION!

*/

//#define int long long //UNCOMMENT IF NEEDED

int32_t main()
{
    fast;

    int m, h, c, e, n, k;
    int x, q, l, r, y;

    string s, t, u;

    auto start = high_resolution_clock::now();

    int tcnt = 0;

    int tests = 1;
    //pre();

    //cin >> tests;

    while (tests--)
    {
        //cout << "Case #" << ++tcnt << ": ";
        cin >> n >> k >> s;
        bool alt = 1;
        f(i, 0, n) alt &= s[i] != s[(i + 1) % n];
        if (alt)
        {
            if (k & 1)
            {
                for (auto y : s)
                    if (y == 'W')
                        cout << 'B';
                    else
                        cout << 'W';
            }
            else
                cout << s;
            return 0;
        }
        bool fate[n];
        int time[n];
        mem(time, 0);
        vpii alts;
        l = -1;
        f(i, 0, n) if (s[i] != s[(i + 1) % n] && s[i] != s[(i - 1 + n) % n])
        {
            if (l == -1)
                l = i;
        }
        else if (l != -1) alts.pb({l, i - 1}), l = -1;
        if (!alts[0].ff && alts.back().ss == n - 1)
        {
            pii p = {alts.back().ff, alts[0].ss};
            alts.pop_back();
            swap(alts[0], alts.back());
            alts.pop_back();
            alts.pb(p);
        }
        bool con[n];
        mem(con, 0);
        f(i, 0, n) con[i] = (s[i] == 'W');
        for (auto y : alts)
        {
            l = y.ff;
            r = y.ss;
            if (r < l)
                r += n;
            if ((r - l) & 1)
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n] ^ 1;
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
            }
            else
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n];
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
                time[(l + r) / 2] = (r - l + 1) / 2 + 1;
                fate[(l + r) / 2] = con[(l - 1 + n) % n];
            }
        } //dbgc(time);dbgc(fate);
        f(i, 0, n) if (!time[i]) cout << s[i];
        else if (k >= time[i]) cout << (fate[i] ? 'W' : 'B');
        else if (s[i] == 'W') cout << ((k & 1) ? 'B' : 'W');
        else cout << ((k & 1) ? 'W' : 'B');
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr << "Time taken: "
         << duration.count() / 1000000.0 << "seconds" << nl;
    return 0;
}

// AND THE GAME IS OVER !!


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double

#define pb push_back
#define ins insert
#define er erase

#define f(i, a, b) for (int i = a; i < b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define cadd(a, b) a = add(a, b)
#define csub(a, b) a = subt(a, b)
#define cmul(a, b) a = mult(a, b)
#define mem(a, b) memset(a, b, sizeof(a))

#define vi vector<int>
#define vst vector<string>
#define vpii vector<pii>

#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define ff first
#define ss second

#define bs bitset
#define bpc(a) __builtin_popcount(a)

#define mii map<int, int>
#define umii unordered_map<int, int>

#define si set<int>
#define usi unordered_set<int>
#define spii set<pii>

#define pqi priority_queue<int>
#define pqpii priority_queue<pii>

#define dbg(a, st, end)                   \
    f(i, st, end + 1) cerr << a[i] << sp; \
    cerr << nl;
#define pnt(a, st, end)                   \
    f(i, st, end + 1) cout << a[i] << sp; \
    cout << nl;
#define dbgc(a)          \
    for (auto y : a)     \
        cerr << y << sp; \
    cerr << nl;
#define dbgm(a)                            \
    for (auto y : a)                       \
        cerr << y.ff << "," << y.ss << sp; \
    cerr << nl;

#define trace(a) cerr << a << nl;
#define trace2(a, b) cerr << a << sp << b << nl;
#define trace3(a, b, c) cerr << a << sp << b << sp << c << nl;
#define trace4(a, b, c, d) cerr << a << sp << b << sp << c << sp << d << nl;

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
#define sp " "

using namespace std;
using namespace std::chrono;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ok order_of_key
#define fo find_by_order

//ll md = 1000000007;
ld pi = 3.141592653;
ll md = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}

ll modinv(ll n)
{
    return pwmd(n, md - 2);
}

ll my_ceil(ll a, ll b)
{
    if (a % b == 0)
        return a / b;
    return a / b + 1;
}

ll nc2(ll n)
{
    return (1ll * n * (n - 1)) / 2;
}

ll nsum(ll n)
{
    return (1ll * n * (n + 1)) / 2;
}

int my_log(ll n, int b)
{
    ll i = 1;
    int ans = 0;
    while (1)
    {
        if (i > n / b)
            break;
        i *= b;
        ans++;
    }
    return ans;
}

inline int nc()
{
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
    int ret = 0;
    bool f = 0;
    char ch = nc();
    while (ch > '9' || ch < '0')
        f ^= ch == '-', ch = nc();
    while (ch <= '9' && ch >= '0')
        ret = ret * 10 + ch - '0', ch = nc();
    return f ? -ret : ret;
}

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

inline ll add(ll a, ll b) { return (((a >= md) ? a % md : a) + ((b >= md) ? b % md : b) + md) % md; }
inline ll subt(ll a, ll b) { return (a - b + md) % md; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= md) ? a % md : a) * ((b >= md) ? b % md : b)) % md; }

inline int manhatten(pii p1, pii p2) { return abs(p1.ff - p2.ff) + abs(p1.ss - p2.ss); }

inline bool kthbit(ll n, int k) { return (n >> k) & 1; }
inline ll setkthbit(ll n, int k) { return n | (1ll << k); }
inline ll unsetkthbit(ll n, int k) { return n & ~(1ll << k); }
inline ll flipkthbit(ll n, int k) { return n ^ (1ll << k); }

//LET'S PLAY THE GAME!!

/*

CHECK FOR N=1, N=2, etc;
REMOVE DEBUG STATEMENTS
CHECK FOR DUPLICATES (SET -> MULTISET)
CHECK FOR OVERFLOW
CLEAR EVERYTHING BEFORE EVERY TESTCASE
DON'T MISTAKE ROOT FOR LEAF
DON'T ALWAYS IGNORE THE BRUTE FORCE SOLUTION!

*/

//#define int long long //UNCOMMENT IF NEEDED

int32_t main()
{
    fast;

    int m, h, c, e, n, k;
    int x, q, l, r, y;

    string s, t, u;

    auto start = high_resolution_clock::now();

    int tcnt = 0;

    int tests = 1;
    //pre();

    //cin >> tests;

    while (tests--)
    {
        //cout << "Case #" << ++tcnt << ": ";
        cin >> n >> k >> s;
        bool alt = 1;
        int cntw = 0;
        f(i, 0, n) alt &= s[i] != s[(i + 1) % n], cntw += (s[i] == 'W');
        if (!cntw || cntw == n)
        {
            cout << s;
            return 0;
        }
        if (alt)
        {
            if (k & 1)
            {
                for (auto y : s)
                    if (y == 'W')
                        cout << 'B';
                    else
                        cout << 'W';
            }
            else
                cout << s;
            return 0;
        }
        bool fate[n];
        int time[n];
        mem(time, 0);
        vpii alts;
        l = -1;
        f(i, 0, n) if (s[i] != s[(i + 1) % n] && s[i] != s[(i - 1 + n) % n])
        {
            if (l == -1)
                l = i;
        }
        else if (l != -1) alts.pb({l, i - 1}), l = -1;
        if (l != -1)
            alts.pb({l, n - 1});
        if (!alts[0].ff && alts.back().ss == n - 1)
        {
            pii p = {alts.back().ff, alts[0].ss};
            alts.pop_back();
            swap(alts[0], alts.back());
            alts.pop_back();
            alts.pb(p);
        }
        //dbgm(alts);
        bool con[n];
        mem(con, 0);
        f(i, 0, n) con[i] = (s[i] == 'W');
        for (auto y : alts)
        {
            l = y.ff;
            r = y.ss;
            if (r < l)
                r += n;
            if ((r - l) & 1)
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n] ^ 1;
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
            }
            else
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n];
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
                time[((l + r) / 2) % n] = (r - l + 1) / 2 + 1;
                fate[((l + r) / 2) % n] = con[(l - 1 + n) % n];
            }
        } //dbgc(time);dbgc(fate);
        f(i, 0, n) if (!time[i]) cout << s[i];
        else if (k >= time[i]) cout << (fate[i] ? 'W' : 'B');
        else if (s[i] == 'W') cout << ((k & 1) ? 'B' : 'W');
        else cout << ((k & 1) ? 'W' : 'B');
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr << "Time taken: "
         << duration.count() / 1000000.0 << "seconds" << nl;
    return 0;
}

// AND THE GAME IS OVER !!


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double

#define pb push_back
#define ins insert
#define er erase

#define f(i, a, b) for (int i = a; i < b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define cadd(a, b) a = add(a, b)
#define csub(a, b) a = subt(a, b)
#define cmul(a, b) a = mult(a, b)
#define mem(a, b) memset(a, b, sizeof(a))

#define vi vector<int>
#define vst vector<string>
#define vpii vector<pii>

#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define ff first
#define ss second

#define bs bitset
#define bpc(a) __builtin_popcount(a)

#define mii map<int, int>
#define umii unordered_map<int, int>

#define si set<int>
#define usi unordered_set<int>
#define spii set<pii>

#define pqi priority_queue<int>
#define pqpii priority_queue<pii>

#define dbg(a, st, end)                   \
    f(i, st, end + 1) cerr << a[i] << sp; \
    cerr << nl;
#define pnt(a, st, end)                   \
    f(i, st, end + 1) cout << a[i] << sp; \
    cout << nl;
#define dbgc(a)          \
    for (auto y : a)     \
        cerr << y << sp; \
    cerr << nl;
#define dbgm(a)                            \
    for (auto y : a)                       \
        cerr << y.ff << "," << y.ss << sp; \
    cerr << nl;

#define trace(a) cerr << a << nl;
#define trace2(a, b) cerr << a << sp << b << nl;
#define trace3(a, b, c) cerr << a << sp << b << sp << c << nl;
#define trace4(a, b, c, d) cerr << a << sp << b << sp << c << sp << d << nl;

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
#define sp " "

using namespace std;
using namespace std::chrono;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ok order_of_key
#define fo find_by_order

//ll md = 1000000007;
ld pi = 3.141592653;
ll md = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}

ll modinv(ll n)
{
    return pwmd(n, md - 2);
}

ll my_ceil(ll a, ll b)
{
    if (a % b == 0)
        return a / b;
    return a / b + 1;
}

ll nc2(ll n)
{
    return (1ll * n * (n - 1)) / 2;
}

ll nsum(ll n)
{
    return (1ll * n * (n + 1)) / 2;
}

int my_log(ll n, int b)
{
    ll i = 1;
    int ans = 0;
    while (1)
    {
        if (i > n / b)
            break;
        i *= b;
        ans++;
    }
    return ans;
}

inline int nc()
{
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
    int ret = 0;
    bool f = 0;
    char ch = nc();
    while (ch > '9' || ch < '0')
        f ^= ch == '-', ch = nc();
    while (ch <= '9' && ch >= '0')
        ret = ret * 10 + ch - '0', ch = nc();
    return f ? -ret : ret;
}

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

inline ll add(ll a, ll b) { return (((a >= md) ? a % md : a) + ((b >= md) ? b % md : b) + md) % md; }
inline ll subt(ll a, ll b) { return (a - b + md) % md; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= md) ? a % md : a) * ((b >= md) ? b % md : b)) % md; }

inline int manhatten(pii p1, pii p2) { return abs(p1.ff - p2.ff) + abs(p1.ss - p2.ss); }

inline bool kthbit(ll n, int k) { return (n >> k) & 1; }
inline ll setkthbit(ll n, int k) { return n | (1ll << k); }
inline ll unsetkthbit(ll n, int k) { return n & ~(1ll << k); }
inline ll flipkthbit(ll n, int k) { return n ^ (1ll << k); }

//LET'S PLAY THE GAME!!

/*

CHECK FOR N=1, N=2, etc;
REMOVE DEBUG STATEMENTS
CHECK FOR DUPLICATES (SET -> MULTISET)
CHECK FOR OVERFLOW
CLEAR EVERYTHING BEFORE EVERY TESTCASE
DON'T MISTAKE ROOT FOR LEAF
DON'T ALWAYS IGNORE THE BRUTE FORCE SOLUTION!

*/

//#define int long long //UNCOMMENT IF NEEDED

int32_t main()
{
    fast;

    int m, h, c, e, n, k;
    int x, q, l, r, y;

    string s, t, u;

    auto start = high_resolution_clock::now();

    int tcnt = 0;

    int tests = 1;
    //pre();

    //cin >> tests;

    while (tests--)
    {
        //cout << "Case #" << ++tcnt << ": ";
        cin >> n >> k >> s;
        bool alt = 1;
        int cntw = 0;
        f(i, 0, n) alt &= s[i] != s[(i + 1) % n], cntw += (s[i] == 'W');
        if (!cntw || cntw == n)
        {
            cout << s;
            return 0;
        }
        if (alt)
        {
            if (k & 1)
            {
                for (auto y : s)
                    if (y == 'W')
                        cout << 'B';
                    else
                        cout << 'W';
            }
            else
                cout << s;
            return 0;
        }
        bool fate[n];
        int time[n];
        mem(time, 0);
        vpii alts;
        l = -1;
        f(i, 0, n) if (s[i] != s[(i + 1) % n] && s[i] != s[(i - 1 + n) % n])
        {
            if (l == -1)
                l = i;
        }
        else if (l != -1) alts.pb({l, i - 1}), l = -1;
        if (!alts[0].ff && alts.back().ss == n - 1)
        {
            pii p = {alts.back().ff, alts[0].ss};
            alts.pop_back();
            swap(alts[0], alts.back());
            alts.pop_back();
            alts.pb(p);
        }
        bool con[n];
        mem(con, 0);
        f(i, 0, n) con[i] = (s[i] == 'W');
        for (auto y : alts)
        {
            l = y.ff;
            r = y.ss;
            if (r < l)
                r += n;
            if ((r - l) & 1)
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n] ^ 1;
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
            }
            else
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n];
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
                time[(l + r) / 2] = (r - l + 1) / 2 + 1;
                fate[(l + r) / 2] = con[(l - 1 + n) % n];
            }
        } //dbgc(time);dbgc(fate);
        f(i, 0, n) if (!time[i]) cout << s[i];
        else if (k >= time[i]) cout << (fate[i] ? 'W' : 'B');
        else if (s[i] == 'W') cout << ((k & 1) ? 'B' : 'W');
        else cout << ((k & 1) ? 'W' : 'B');
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr << "Time taken: "
         << duration.count() / 1000000.0 << "seconds" << nl;
    return 0;
}

// AND THE GAME IS OVER !!


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double

#define pb push_back
#define ins insert
#define er erase

#define f(i, a, b) for (int i = a; i < b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define cmax(a, b) a = max(a, b)
#define cmin(a, b) a = min(a, b)
#define cadd(a, b) a = add(a, b)
#define csub(a, b) a = subt(a, b)
#define cmul(a, b) a = mult(a, b)
#define mem(a, b) memset(a, b, sizeof(a))

#define vi vector<int>
#define vst vector<string>
#define vpii vector<pii>

#define all(v) v.begin(), v.end()
#define lb lower_bound
#define ub upper_bound
#define mxe max_element
#define mne min_element

#define srt(v) sort(all(v))
#define rsrt(v) sort(v.rbegin(), v.rend())

#define pii pair<int, int>
#define ff first
#define ss second

#define bs bitset
#define bpc(a) __builtin_popcount(a)

#define mii map<int, int>
#define umii unordered_map<int, int>

#define si set<int>
#define usi unordered_set<int>
#define spii set<pii>

#define pqi priority_queue<int>
#define pqpii priority_queue<pii>

#define dbg(a, st, end)                   \
    f(i, st, end + 1) cerr << a[i] << sp; \
    cerr << nl;
#define pnt(a, st, end)                   \
    f(i, st, end + 1) cout << a[i] << sp; \
    cout << nl;
#define dbgc(a)          \
    for (auto y : a)     \
        cerr << y << sp; \
    cerr << nl;
#define dbgm(a)                            \
    for (auto y : a)                       \
        cerr << y.ff << "," << y.ss << sp; \
    cerr << nl;

#define trace(a) cerr << a << nl;
#define trace2(a, b) cerr << a << sp << b << nl;
#define trace3(a, b, c) cerr << a << sp << b << sp << c << nl;
#define trace4(a, b, c, d) cerr << a << sp << b << sp << c << sp << d << nl;

#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)

#define nl "\n"
#define sp " "

using namespace std;
using namespace std::chrono;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ok order_of_key
#define fo find_by_order

//ll md = 1000000007;
ld pi = 3.141592653;
ll md = 998244353;

ll pw(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m);
        m = (m * m);
        b /= 2;
    }
    return c;
}

ll pwmd(ll a, ll b)
{
    ll c = 1, m = a;
    while (b)
    {
        if (b & 1)
            c = (c * m) % md;
        m = (m * m) % md;
        b /= 2;
    }
    return c;
}

ll modinv(ll n)
{
    return pwmd(n, md - 2);
}

ll my_ceil(ll a, ll b)
{
    if (a % b == 0)
        return a / b;
    return a / b + 1;
}

ll nc2(ll n)
{
    return (1ll * n * (n - 1)) / 2;
}

ll nsum(ll n)
{
    return (1ll * n * (n + 1)) / 2;
}

int my_log(ll n, int b)
{
    ll i = 1;
    int ans = 0;
    while (1)
    {
        if (i > n / b)
            break;
        i *= b;
        ans++;
    }
    return ans;
}

inline int nc()
{
    static char buf[100000], *p1 = buf, *p2 = buf;
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++;
}
inline int read()
{
    int ret = 0;
    bool f = 0;
    char ch = nc();
    while (ch > '9' || ch < '0')
        f ^= ch == '-', ch = nc();
    while (ch <= '9' && ch >= '0')
        ret = ret * 10 + ch - '0', ch = nc();
    return f ? -ret : ret;
}

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

inline ll add(ll a, ll b) { return (((a >= md) ? a % md : a) + ((b >= md) ? b % md : b) + md) % md; }
inline ll subt(ll a, ll b) { return (a - b + md) % md; }
inline ll mult(ll a, ll b) { return (1ll * ((a >= md) ? a % md : a) * ((b >= md) ? b % md : b)) % md; }

inline int manhatten(pii p1, pii p2) { return abs(p1.ff - p2.ff) + abs(p1.ss - p2.ss); }

inline bool kthbit(ll n, int k) { return (n >> k) & 1; }
inline ll setkthbit(ll n, int k) { return n | (1ll << k); }
inline ll unsetkthbit(ll n, int k) { return n & ~(1ll << k); }
inline ll flipkthbit(ll n, int k) { return n ^ (1ll << k); }

//LET'S PLAY THE GAME!!

/*

CHECK FOR N=1, N=2, etc;
REMOVE DEBUG STATEMENTS
CHECK FOR DUPLICATES (SET -> MULTISET)
CHECK FOR OVERFLOW
CLEAR EVERYTHING BEFORE EVERY TESTCASE
DON'T MISTAKE ROOT FOR LEAF
DON'T ALWAYS IGNORE THE BRUTE FORCE SOLUTION!

*/

//#define int long long //UNCOMMENT IF NEEDED

int32_t main()
{
    fast;

    int m, h, c, e, n, k;
    int x, q, l, r, y;

    string s, t, u;

    auto start = high_resolution_clock::now();

    int tcnt = 0;

    int tests = 1;
    //pre();

    //cin >> tests;

    while (tests--)
    {
        //cout << "Case #" << ++tcnt << ": ";
        cin >> n >> k >> s;
        bool alt = 1;
        int cntw = 0;
        f(i, 0, n) alt &= s[i] != s[(i + 1) % n], cntw += (s[i] == 'W');
        if (!cntw || cntw == n)
        {
            cout << s;
            return 0;
        }
        if (alt)
        {
            if (k & 1)
            {
                for (auto y : s)
                    if (y == 'W')
                        cout << 'B';
                    else
                        cout << 'W';
            }
            else
                cout << s;
            return 0;
        }
        bool fate[n];
        int time[n];
        mem(time, 0);
        vpii alts;
        l = -1;
        f(i, 0, n) if (s[i] != s[(i + 1) % n] && s[i] != s[(i - 1 + n) % n])
        {
            if (l == -1)
                l = i;
        }
        else if (l != -1) alts.pb({l, i - 1}), l = -1;
        if (l != -1)
            alts.pb({l, n - 1});
        if (!alts.empty() && !alts[0].ff && alts.back().ss == n - 1)
        {
            pii p = {alts.back().ff, alts[0].ss};
            alts.pop_back();
            swap(alts[0], alts.back());
            alts.pop_back();
            alts.pb(p);
        }
        //dbgm(alts);
        bool con[n];
        mem(con, 0);
        f(i, 0, n) con[i] = (s[i] == 'W');
        for (auto y : alts)
        {
            l = y.ff;
            r = y.ss;
            if (r < l)
                r += n;
            if ((r - l) & 1)
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n] ^ 1;
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
            }
            else
            {
                f(j, 0, (r - l + 1) / 2)
                {
                    fate[(l + j) % n] = con[(l - 1 + n) % n];
                    fate[(r - j) % n] = fate[(l + j) % n];
                    time[(l + j) % n] = time[(r - j) % n] = j + 1;
                }
                time[((l + r) / 2) % n] = (r - l + 1) / 2 + 1;
                fate[((l + r) / 2) % n] = con[(l - 1 + n) % n];
            }
        } //dbgc(time);dbgc(fate);
        f(i, 0, n) if (!time[i]) cout << s[i];
        else if (k >= time[i]) cout << (fate[i] ? 'W' : 'B');
        else if (s[i] == 'W') cout << ((k & 1) ? 'B' : 'W');
        else cout << ((k & 1) ? 'W' : 'B');
    }
    auto stop = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop - start);
    cerr << "Time taken: "
         << duration.count() / 1000000.0 << "seconds" << nl;
    return 0;
}

// AND THE GAME IS OVER !!


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

ll n,lista[500000],k;
string s;
vector<pair<ll,ll>> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    cin >> s;
    for(int i=1;i<=n;i++){
        if(s[i-1]=='B')lista[i]=1;
        else lista[i]=0;
    }
    pair<ll,ll> now={0,0};
    bool open=false;
    for(int i=1;i<=n;i++){
        if(i==1){
            if(lista[i+1]==lista[n] && lista[i+1]!=lista[i]){
                now.first=i;
                now.second=i;
                open=true;
            }
        }
        else if(i==n){
            if(lista[1]==lista[i-1] && lista[i-1]!=lista[i]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                }
                v.pb(now);
            }
            else if(lista[i-1]!=lista[1] && open)
                v.pb(now);

        }
        else{
            if(lista[i+1]==lista[i-1] && lista[i]!=lista[i+1]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                    open=true;
                }
            }
            else if(lista[i+1]!=lista[i-1] && open){
                v.pb(now);
                now={0,0};
                open=false;
            }
        }
    }
    //for(auto i : v)cout << i.first << ' ' << i.second << endl;

    if(v.size()==0){
        cout << s;
        return 0;
    }
    if(v[v.size()-1].second==n && v[0].first==1 && v.size()!=1){
        v[0].first=v[v.size()-1].first;
        if(v[0].first>v[0].second)v[0].second+=n;
        v.pop_back();
    }
    if(v.size()==1 && v[0].first==1 && v[0].second==n){
        if(k&1){
            for(int i=0;i<n;i++){
                if(s[i]=='B')cout << 'W';
                else cout << 'B';
            }
        }
        else{
                cout << s;

        }
        return 0;
    }
    else{

        for(auto i:v){
            ll l=i.first;
            ll r=i.second;
            if((r-l+1)&1){
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l+1<r && temp){
                    if(ucrno){
                        if(l<=n)lista[l]=1;
                        else lista[l%n]=1;
                        if(r>n)lista[r%n]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    else{
                        if(l<=n)lista[l]=0;
                        else lista[l%n]=0;
                        if(r>n)lista[r%n]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    l++;
                    r--;
                }
                if(temp){
                    if(l>n)l-=n;
                    if(ucrno)lista[l]=1;
                    else lista[l]=0;
                }
                else if(temp==0 && k&1){
                    for(int j=l;j<=r;j++){
                        if(j<=n)lista[j]= !lista[j];
                        else lista[j%n]= !lista[j%n];
                    }
                }

            }
            else{
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l<r && temp){
                    if(ucrno){
                        if(l<=n)lista[l]=1;
                        else lista[l%n]=1;
                        if(r>n)lista[r%n]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    else{
                        if(l<=n)lista[l]=0;
                        else lista[l%n]=0;
                        if(r>n)lista[r%n]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    l++;
                    r--;
                }
                for(int j=l;j<=r;j++){
                    if(k&1==0)break;
                    if(j<=n)lista[j]= !lista[j];
                    else lista[j%n]= !lista[j%n];
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        if(lista[i]==1)cout << "B";
        else cout << "W";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

ll n,lista[500000],k;
string s;
vector<pair<ll,ll>> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    cin >> s;
    for(int i=1;i<=n;i++){
        if(s[i-1]=='B')lista[i]=1;
        else lista[i]=0;
    }
    pair<ll,ll> now={0,0};
    bool open=false;
    for(int i=1;i<=n;i++){
        if(i==1){
            if(lista[i+1]==lista[n] && lista[i+1]!=lista[i]){
                now.first=i;
                now.second=i;
                open=true;
            }
        }
        else if(i==n){
            if(lista[1]==lista[i-1] && lista[i-1]!=lista[i]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                }
                v.pb(now);
            }
            else if(lista[i-1]!=lista[1] && open)
                v.pb(now);

        }
        else{
            if(lista[i+1]==lista[i-1] && lista[i]!=lista[i+1]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                    open=true;
                }
            }
            else if(lista[i+1]!=lista[i-1] && open){
                v.pb(now);
                now={0,0};
                open=false;
            }
        }
    }
    //for(auto i : v)cout << i.first << ' ' << i.second << endl;

    if(v.size()==0){
        cout << s;
        return 0;
    }
    if(v[v.size()-1].second==n && v[0].first==1 && v.size()!=1){
        v[0].first=v[v.size()-1].first;
        v[0].second+=n;
        v.pop_back();
    }
    if(v.size()==1 && v[0].first==1 && v[0].second==n){
        if(k&1){
            for(int i=0;i<n;i++){
                if(s[i]=='B')cout << 'W';
                else cout << 'B';
            }
        }
        else{
                cout << s;

        }
        return 0;
    }
    else{

        for(auto i:v){
            ll l=i.first;
            ll r=i.second;
            if((r-l+1)&1){
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l+2<=r && temp){
                    if(ucrno){
                        lista[(r/n>0)+(l%n)]=1;
                        lista[(r/n>0)+(r%n)]=1;
                        temp--;
                    }
                    else{
                        lista[(l/n>0)+(l%n)]=0;
                        lista[(r/n>0)+(r%n)]=0;
                        temp--;
                    }
                    l++;
                    r--;
                }
                if(temp){
                    if(ucrno)lista[(l/n>0)+(l%n)]=1;
                    else lista[(l/n>0)+(l%n)]=0;
                }
            }
            else{
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l<r && temp){
                    if(ucrno){
                        lista[(l/n>0)+(l%n)]=1;
                        lista[(r/n>0)+(r%n)]=0;
                        temp--;
                    }
                    else{
                        lista[(l/n>0)+(l%n)]=0;
                        lista[(r/n>0)+(r%n)]=1;
                        temp--;
                    }
                    l++;
                    r--;
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        if(lista[i]==1)cout << "B";
        else cout << "W";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

ll n,lista[500000],k;
string s;
vector<pair<ll,ll>> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    cin >> s;
    for(int i=1;i<=n;i++){
        if(s[i-1]=='B')lista[i]=1;
        else lista[i]=0;
    }
    pair<ll,ll> now={0,0};
    bool open=false;
    for(int i=1;i<=n;i++){
        if(i==1){
            if(lista[i+1]==lista[n] && lista[i+1]!=lista[i]){
                now.first=i;
                now.second=i;
                open=true;
            }
        }
        else if(i==n){
            if(lista[1]==lista[i-1] && lista[i-1]!=lista[i]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                }
                v.pb(now);
            }
            else if(lista[i-1]!=lista[1] && open)
                v.pb(now);

        }
        else{
            if(lista[i+1]==lista[i-1] && lista[i]!=lista[i+1]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                    open=true;
                }
            }
            else if(lista[i+1]!=lista[i-1] && open){
                v.pb(now);
                now={0,0};
                open=false;
            }
        }
    }
    //for(auto i : v)cout << i.first << ' ' << i.second << endl;

    if(v.size()==0){
        cout << s;
        return 0;
    }
    if(v[v.size()-1].second==n && v[0].first==1 && v.size()!=1){
        v[0].first=v[v.size()-1].first;
        v[0].second+=n;
        v.pop_back();
    }
    if(v.size()==1 && v[0].first==1 && v[0].second==n){
        if(k&1){
            for(int i=0;i<n;i++){
                if(s[i]=='B')cout << 'W';
                else cout << 'B';
            }
        }
        else{
                cout << s;

        }
        return 0;
    }
    else{

        for(auto i:v){
            ll l=i.first;
            ll r=i.second;
            if((r-l+1)&1){
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l+2<=r && temp){
                    if(ucrno){
                        lista[l]=1;
                        if(r>n)lista[(r%n)]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    else{
                        lista[l]=0;
                        if(r>n)lista[(r%n)]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    l++;
                    r--;
                }
                if(temp){
                    if(ucrno)lista[l]=1;
                    else lista[l]=0;
                }
            }
            else{
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l<r && temp){
                    if(ucrno){
                        lista[l]=1;
                        if(r>n)lista[r%n]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    else{
                        lista[l]=0;
                        if(r>n)lista[(r%n)]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    l++;
                    r--;
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        if(lista[i]==1)cout << "B";
        else cout << "W";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

ll n,lista[500000],k;
string s;
vector<pair<ll,ll>> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    cin >> s;
    for(int i=1;i<=n;i++){
        if(s[i-1]=='B')lista[i]=1;
        else lista[i]=0;
    }
    pair<ll,ll> now={0,0};
    bool open=false;
    for(int i=1;i<=n;i++){
        if(i==1){
            if(lista[i+1]==lista[n] && lista[i+1]!=lista[i]){
                now.first=i;
                open=true;
            }
        }
        else if(i==n){
            if(lista[1]==lista[i-1] && lista[i-1]!=lista[i]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                }
                v.pb(now);
            }
            else if(lista[i-1]!=lista[1] && open)
                v.pb(now);

        }
        else{
            if(lista[i+1]==lista[i-1] && lista[i]!=lista[i+1]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    open=true;
                }
            }
            else if(lista[i+1]!=lista[i-1] && open){
                v.pb(now);
                now={0,0};
                open=false;
            }
        }
    }
    //for(auto i : v)cout << i.first << ' ' << i.second << endl;

    if(v.size()==0){
        cout << s;
        return 0;
    }
    if(v[v.size()-1].second==n && v[0].first==1 && v.size()!=1){
        v[0].first=v[v.size()-1].first;
        v[0].second+=n;
        v.pop_back();
    }
    if(v.size()==1 && v[0].first==1 && v[0].second==n){
        if(k&1){
            for(int i=0;i<n;i++){
                if(s[i]=='B')cout << 'W';
                else cout << 'B';
            }
        }
        else{
                cout << s;

        }
        return 0;
    }
    else{

        for(auto i:v){
            ll l=i.first;
            ll r=i.second;
            if((r-l+1)&1){
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l+2<=r && temp){
                    if(ucrno){
                        lista[(r/n>0)+(l%n)]=1;
                        lista[(r/n>0)+(r%n)]=1;
                        temp--;
                    }
                    else{
                        lista[(l/n>0)+(l%n)]=0;
                        lista[(r/n>0)+(r%n)]=0;
                        temp--;
                    }
                    l++;
                    r--;
                }
                if(temp){
                    if(ucrno)lista[(l/n>0)+(l%n)]=1;
                    else lista[(l/n>0)+(l%n)]=0;
                }
            }
            else{
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l<r && temp){
                    if(ucrno){
                        lista[(l/n>0)+(l%n)]=1;
                        lista[(r/n>0)+(r%n)]=0;
                        temp--;
                    }
                    else{
                        lista[(l/n>0)+(l%n)]=0;
                        lista[(r/n>0)+(r%n)]=1;
                        temp--;
                    }
                    l++;
                    r--;
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        if(lista[i]==1)cout << "B";
        else cout << "W";
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

ll n,lista[500000],k;
string s;
vector<pair<ll,ll>> v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;
    cin >> s;
    for(int i=1;i<=n;i++){
        if(s[i-1]=='B')lista[i]=1;
        else lista[i]=0;
    }
    pair<ll,ll> now={0,0};
    bool open=false;
    for(int i=1;i<=n;i++){
        if(i==1){
            if(lista[i+1]==lista[n] && lista[i+1]!=lista[i]){
                now.first=i;
                now.second=i;
                open=true;
            }
        }
        else if(i==n){
            if(lista[1]==lista[i-1] && lista[i-1]!=lista[i]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                }
                v.pb(now);
            }
            else if(lista[i-1]!=lista[1] && open)
                v.pb(now);

        }
        else{
            if(lista[i+1]==lista[i-1] && lista[i]!=lista[i+1]){
                if(open){
                    now.second=i;
                }
                else{
                    now.first=i;
                    now.second=i;
                    open=true;
                }
            }
            else if(lista[i+1]!=lista[i-1] && open){
                v.pb(now);
                now={0,0};
                open=false;
            }
        }
    }
    //for(auto i : v)cout << i.first << ' ' << i.second << endl;

    if(v.size()==0){
        cout << s;
        return 0;
    }
    if(v[v.size()-1].second==n && v[0].first==1 && v.size()!=1){
        v[0].first=v[v.size()-1].first;
        v[0].second+=n;
        v.pop_back();
    }
    if(v.size()==1 && v[0].first==1 && v[0].second==n){
        if(k&1){
            for(int i=0;i<n;i++){
                if(s[i]=='B')cout << 'W';
                else cout << 'B';
            }
        }
        else{
                cout << s;

        }
        return 0;
    }
    else{

        for(auto i:v){
            ll l=i.first;
            ll r=i.second;
            if((r-l+1)&1){
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l+2<=r && temp){
                    if(ucrno){
                        if(l<=n)lista[l]=1;
                        else lista[l%n]=1;
                        if(r>n)lista[(r%n)]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    else{
                        if(l<=n)lista[l]=0;
                        else lista[l%n]=0;
                        if(r>n)lista[(r%n)]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    l++;
                    r--;
                }
                if(temp){
                    if(l>n)l-=n;
                    if(ucrno)lista[l]=1;
                    else lista[l]=0;
                }
                if(temp==0 && k&1){
                    for(int i=l;i<=r;i++){
                        if(i<=n)lista[i]=!lista[i];
                        else lista[i%n]=!lista[i];
                    }
                }

            }
            else{
                ll temp=k;
                bool ucrno=false;
                if(lista[l]==0){
                    ucrno=true;
                }
                while(l<r && temp){
                    if(ucrno){
                        if(l<=n)lista[l]=1;
                        else lista[l%n]=1;
                        if(r>n)lista[r%n]=0;
                        else lista[r]=0;
                        temp--;
                    }
                    else{
                        if(l<=n)lista[l]=0;
                        else lista[l%n]=0;
                        if(r>n)lista[(r%n)]=1;
                        else lista[r]=1;
                        temp--;
                    }
                    l++;
                    r--;
                }
                for(int i=l;i<=r;i++){
                    if(k&1==0)break;
                    if(i<=n)lista[i]=!lista[i];
                        else lista[i%n]=!lista[i];
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        if(lista[i]==1)cout << "B";
        else cout << "W";
    }

    return 0;
}