#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;
                }
            }
            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=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+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;
                }
                if(temp==0 && k&1 && l!=r){
                    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;
}


#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(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(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>0){
                    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>0){
                    if(l>n)l-=n;
                    if(ucrno)lista[l]=1;
                    else lista[l]=0;
                    temp--;
                }
                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>0){
                    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--;
                }
                if(k&1 && temp<=0){
                    for(int j=l;j<=r;j++){
                        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+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;
                }
                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%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 i=l;i<=r;i++){
                    if(k&1==0)break;
                    if(i<=n)lista[i]=!lista[i];
                        else lista[i%n]=!lista[i%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 X first
#define Y second
#define ll long long
#define ld double
#define up_b upper_bound
#define low_b lower_bound
#define pb push_back
#define mp make_pair

typedef pair<int,char> pii;

const int N=2e5;

char s[2*N+5];
int n,k;
pii f[2*N+5];
char Rev(char t)
{
    if (t=='W') return 'B';
    return 'W';
}
int main()
{
   // freopen("cf.inp","r",stdin);
   // freopen("cf.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>k;
    for (int i=1;i<=n;i++) cin>>s[i];
    for (int i=1;i<=n;i++) s[i+n]=s[i];
//    for (int i=1;i<=2*n;i++) cout<<s[i]<<' ';
//    cout<<endl;
    pii d=mp(1e9,'?');
    f[1]=d;
    for (int i=2;i<=2*n;i++)
    {
        d.X++;
        if (s[i]==s[i-1]) d=mp(0,s[i]),f[i]=f[i-1]=d;
        else f[i]=d;
    }
    d=mp(1e9,'?');
    f[2*n]=min(d,f[2*n]);
    for (int i=2*n-1;i>=1;i--)
    {
        d.X++;
        if (s[i]==s[i+1]) d=mp(0,s[i]),f[i]=f[i+1]=d;
        else f[i]=min(d,f[i]);
    }
    for (int i=1;i<=n;i++)
    {
        f[i]=min(f[i],f[i+n]);
        if (f[i].X<=k) cout<<f[i].Y;
        else if (k%2==0) cout<<s[i];
        else cout<<Rev(s[i]);
    }
}


#include<bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define ll long long
#define ld double
#define up_b upper_bound
#define low_b lower_bound
#define pb push_back
#define mp make_pair

typedef pair<int,char> pii;

const int N=2e5;

char s[2*N+5];
int n,k;
pii f[2*N+5];
char Rev(char t)
{
    if (t=='W') return 'B';
    return 'W';
}
int main()
{
   // freopen("cf.inp","r",stdin);
   // freopen("cf.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>k;
    for (int i=1;i<=n;i++) cin>>s[i];
    for (int i=1;i<=n;i++) s[i+n]=s[i];
//    for (int i=1;i<=2*n;i++) cout<<s[i]<<' ';
//    cout<<endl;
    pii d=mp(1e9+5,'?');
    f[1]=d;
    for (int i=2;i<=2*n;i++)
    {
        d.X++;
        if (s[i]==s[i-1]) d=mp(0,s[i]),f[i]=f[i-1]=d;
        else f[i]=d;
    }
    d=mp(1e9+5,'?');
    f[2*n]=min(d,f[2*n]);
    for (int i=2*n-1;i>=1;i--)
    {
        d.X++;
        if (s[i]==s[i+1]) d=mp(0,s[i]),f[i]=f[i+1]=d;
        else f[i]=min(d,f[i]);
    }
    for (int i=1;i<=n;i++)
    {
        f[i]=min(f[i],f[i+n]);
        if (f[i].X<=k) cout<<f[i].Y;
        else if (k%2==0) cout<<s[i];
        else cout<<Rev(s[i]);
    }
}


#include<bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define ll long long
#define ld double
#define up_b upper_bound
#define low_b lower_bound
#define pb push_back
#define mp make_pair

typedef pair<int,char> pii;

const int N=2e5;

char s[2*N+5];
int n,k;
pii f[2*N+5];
char Rev(char t)
{
    if (t=='W') return 'B';
    return 'W';
}
int main()
{
    //freopen("cf.inp","r",stdin);
    //freopen("cf.out","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>k;
    for (int i=1;i<=n;i++) cin>>s[i];
    for (int i=1;i<=n;i++) s[i+n]=s[i];
//    for (int i=1;i<=2*n;i++) cout<<s[i]<<' ';
//    cout<<endl;
    pii d=mp(1e9+5,'?');
    f[1]=d;
    for (int i=2;i<=2*n;i++)
    {
        d.X++;
        if (s[i]==s[i-1]) d=mp(0,s[i]),f[i]=f[i-1]=d;
        else f[i]=d;
    }
    d=mp(1e9,'?');
    f[2*n]=min(d,f[2*n]);
    for (int i=2*n-1;i>=1;i--)
    {
        d.X++;
        if (s[i]==s[i+1]) d=mp(0,s[i]),f[i]=f[i+1]=d;
        else f[i]=min(d,f[i]);
    }
    for (int i=1;i<=n;i++)
    {
        f[i]=min(f[i],f[i+n]);
        if (f[i].X<=k) cout<<f[i].Y;
        else if (k%2==0) cout<<s[i];
        else cout<<Rev(s[i]);
    }
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

char s[N], aho[N];
int n, k, kolo, m3lsh;

inline int ro7(int i, int inc){
    i += inc;
    if(i == -1)return n - 1;
    if(i == n)return 0;
    return i;
}

char flipCh(char ch){
    if(ch == 'W')
        return 'B';
    return 'W';
}

bool vis[N];

void run(int i, int dir, char ch){
    int tmp = i, len = 0;
    while(aho[tmp] != aho[ro7(tmp, dir)])
        tmp = ro7(tmp, dir), ++len;

    ++tmp;

    int hna = min(k, (len + 1) / 2);

    bool isFlip = (hna & 1);

    while(hna-- && !vis[i]){
        s[i] = ch;
        vis[i] = true;
        i = ro7(i, dir);
    }
    hna = ((len + 1) / 2) - min(k, (len + 1) / 2);

    while(hna-- && !vis[i] && isFlip){
        vis[i] = true;
        s[i] = flipCh(s[i]);
        i = ro7(i, dir);
    }
}

int main(){
    scanf("%d%d%s", &n, &k, &s);
    for(int i = 0 ; i < n ; ++i){
        int l = ro7(i, -1);
        int r = ro7(i, 1);
        if(s[i] == s[r]) ++m3lsh;
        if(s[i] != s[l] && s[i] != s[r]) ++kolo;
    }

    if(kolo == n){
        if(k & 1)
            rotate(s, s + n - 1, s + n);
        printf("%s\n", s);
        exit(0);
    }
    if(m3lsh == n){
        printf("%s\n", s);
        exit(0);
    }

    memcpy(aho, s, n);
    for(int i = 0 ; i < n ; ++i){
        if(vis[i])continue;
        int l = i, r = i;
        while(aho[i] == aho[ro7(l, -1)]){
            l = ro7(l, -1);
            vis[l] = true;
        }
        while(aho[i] == aho[ro7(r, 1)]){
            r = ro7(r, 1);
            vis[r] = true;
        }
        if(l == r)continue;
        vis[i] = true;
        run(ro7(l, -1), -1, aho[i]);
        run(ro7(r, 1), 1, aho[i]);
    }

    printf("%s\n", s);
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

char s[N], aho[N];
int n, k, kolo, m3lsh;

inline int ro7(int i, int inc){
    i += inc;
    if(i == -1)return n - 1;
    if(i == n)return 0;
    return i;
}

char flipCh(char ch){
    if(ch == 'W')
        return 'B';
    return 'W';
}

bool vis[N];

void run(int i, int dir, char ch){
    int tmp = i, len = 0;
    while(aho[tmp] != aho[ro7(tmp, dir)])
        tmp = ro7(tmp, dir), ++len;

    ++tmp;

    int hna = min(k, (len + 1) / 2);
    while(hna-- && !vis[i]){
        s[i] = ch;
        vis[i] = true;
        i = ro7(i, dir);
    }
    hna = ((len + 1) / 2) - min(k, (len + 1) / 2);

    while(hna-- && !vis[i]){
        vis[i] = true;
        s[i] = flipCh(s[i]);
        i = ro7(i, dir);
    }
}

int main(){
    scanf("%d%d%s", &n, &k, &s);
    for(int i = 0 ; i < n ; ++i){
        int l = ro7(i, -1);
        int r = ro7(i, 1);
        if(s[i] == s[r]) ++m3lsh;
        if(s[i] != s[l] && s[i] != s[r]) ++kolo;
    }

    if(kolo == n){
        if(k & 1)
            rotate(s, s + n - 1, s + n);
        printf("%s\n", s);
        exit(0);
    }
    if(m3lsh == n){
        printf("%s\n", s);
        exit(0);
    }

    memcpy(aho, s, n);
    for(int i = 0 ; i < n ; ++i){
        if(vis[i])continue;
        int l = i, r = i;
        while(aho[i] == aho[ro7(l, -1)]){
            l = ro7(l, -1);
            vis[l] = true;
        }
        while(aho[i] == aho[ro7(r, 1)]){
            r = ro7(r, 1);
            vis[r] = true;
        }
        if(l == r)continue;
        vis[i] = true;
        run(ro7(l, -1), -1, aho[i]);
        run(ro7(r, 1), 1, aho[i]);
    }

    printf("%s\n", s);
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

char s[N], aho[N];
int n, k, kolo, m3lsh;

inline int ro7(int i, int inc){
    i += inc;
    if(i == -1)return n - 1;
    if(i == n)return 0;
    return i;
}

inline char flipCh(char ch){
    if(ch == 'W')
        return 'B';
    return 'W';
}

bool vis[N];

void run(int i, int dir, char ch){
    int tmp = i, len = 0;
    while(aho[tmp] != aho[ro7(tmp, dir)])
        tmp = ro7(tmp, dir), ++len;

    int hna = min(k, (len + 1) / 2);
    bool isFlip = (hna & 1);

    while(hna-- && !vis[i]){
        s[i] = ch;
        vis[i] = true;
        i = ro7(i, dir);
    }
    hna = ((len + 1) / 2) - min(k, (len + 1) / 2);

    while(hna-- && !vis[i] && isFlip){
        vis[i] = true;
        s[i] = flipCh(s[i]);
        i = ro7(i, dir);
    }
}

void check(int i, int &idx, int dir){
    while(aho[i] == aho[ro7(idx, dir)]){
        idx = ro7(idx, dir);
        vis[idx] = true;
    }
}

int main(){
    scanf("%d%d%s", &n, &k, &s);
    for(int i = 0 ; i < n ; ++i){
        int l = ro7(i, -1);
        int r = ro7(i, 1);
        if(s[i] == s[r]) ++m3lsh;
        if(s[i] != s[l] && s[i] != s[r]) ++kolo;
    }
    if(kolo == n){
        if(k & 1)
            rotate(s, s + n - 1, s + n);
        printf("%s\n", s);
        exit(0);
    }
    if(m3lsh == n){
        printf("%s\n", s);
        exit(0);
    }
    memcpy(aho, s, n);
    for(int i = 0 ; i < n ; ++i){
        if(vis[i])continue;
        int l = i, r = i;
        check(i, l, -1);
        check(i, r, 1);
        if(l == r)continue;
        vis[i] = true;
        run(ro7(l, -1), -1, aho[i]);
        run(ro7(r, 1), 1, aho[i]);
    }
    printf("%s\n", s);
}


#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5, M = 2 * N + 5;

char s[N], aho[N];
int n, k, kolo, m3lsh;

inline int ro7(int i, int inc){
    i += inc;
    if(i == -1)return n - 1;
    if(i == n)return 0;
    return i;
}

char flipCh(char ch){
    if(ch == 'W')
        return 'B';
    return 'W';
}

bool vis[N];

void run(int i, int dir, char ch){
    int tmp = i, len = 0;
    while(aho[tmp] != aho[ro7(tmp, dir)])
        tmp = ro7(tmp, dir), ++len;

    ++tmp;

    int hna = min(k, len / 2);
    while(hna-- && !vis[i]){
        s[i] = ch;
        vis[i] = true;
        i = ro7(i, dir);
    }
    hna = ((len + 1) / 2) - min(k, len / 2);

    while(hna-- && !vis[i]){
        vis[i] = true;
        s[i] = flipCh(s[i]);
        i = ro7(i, dir);
    }
}

int main(){
    scanf("%d%d%s", &n, &k, &s);
    for(int i = 0 ; i < n ; ++i){
        int l = ro7(i, -1);
        int r = ro7(i, 1);
        if(s[i] == s[r]) ++m3lsh;
        if(s[i] != s[l] && s[i] != s[r]) ++kolo;
    }

    if(kolo == n){
        if(k & 1)
            rotate(s, s + n - 1, s + n);
        printf("%s\n", s);
        exit(0);
    }
    if(m3lsh == n){
        printf("%s\n", s);
        exit(0);
    }

    memcpy(aho, s, n);
    for(int i = 0 ; i < n ; ++i){
        if(vis[i])continue;
        int l = i, r = i;
        while(aho[i] == aho[ro7(l, -1)]){
            l = ro7(l, -1);
            vis[l] = true;
        }
        while(aho[i] == aho[ro7(r, 1)]){
            r = ro7(r, 1);
            vis[r] = true;
        }
        if(l == r)continue;
        vis[i] = true;
        run(ro7(l, -1), -1, aho[i]);
        run(ro7(r, 1), 1, aho[i]);
    }

    printf("%s\n", s);
}


#include <bits/stdc++.h>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) //cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 200200;
int n, k;
string s;
bool block[MAX_N];
pair<int,char> distBlock[MAX_N]; // (distance, value)

char to(char k) {
    return (k == '0') ? 'W' : 'B';
}

char notto(char k) {
    return (k == '0') ? 'B' : 'W';
}

int main() { FAST
    cin >> n >> k >> s;
    M00(i, n) s[i] = (s[i] == 'B') ? '1' : '0';
    M00(i, n) if(s[i] == s[(i+n-1)%n] || s[i] == s[(i+1)%n]) block[i] = 1;
    M00(i, n) distBlock[i] = mp(1e9+5, '?');
    M00(i, n) if(block[i] && !block[(i+1)%n]) {
        int cur = (i+1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d, val));
            cur++;
            if(cur == n) cur = 0;
            d++;
        }
    }
    M00(i, n) if(block[i] && !block[(i+n-1)%n]) {
        int cur = (i+n-1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d,val));
            cur--;
            if(cur == -1) cur = n-1;
            d++;
        }
    }
    M00(i, n) dbg(block[i] _ distBlock[i].f _ distBlock[i].s);
    string ans = "";
    M00(i, n) {
        if(block[i]) ans += to(s[i]);
        else {
            if(distBlock[i].f <= k) ans += to(distBlock[i].s);
            else {
                if(k%2 == 0) ans += to(s[i]);
                else ans += notto(s[i]);
            }
        }
    }
    cout << ans << "\n";
    /*string p; cin >> p;
    if(ans == p) cout << "OK\n";
    else {
        cout << "BAD\n";
        cout << n << " " << k << "\n";
        cout << s << "\n" << ans << "\n" << p << "\n";
    }*/
}


#include <bits/stdc++.h>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) //cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 200200;
int n, k;
string s;
bool block[MAX_N];
pair<int,char> distBlock[MAX_N]; // (distance, value)

char to(char k) {
    return (k == '0') ? 'W' : 'B';
}

char notto(char k) {
    return (k == '0') ? 'B' : 'W';
}

int main() { FAST
    cin >> n >> k >> s;
    M00(i, n) s[i] = (s[i] == 'B') ? '1' : '0';
    M00(i, n) if(s[i] == s[(i+n-1)%n] || s[i] == s[(i+1)%n]) block[i] = 1;
    M00(i, n) distBlock[i] = mp(1e9+5, '?');
    M00(i, n) if(block[i] && !block[(i+1)%n]) {
        int cur = (i+1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d, val));
            cur++;
            if(cur == n) cur = 0;
            d++;
        }
    }
    M00(i, n) if(block[i] && !block[(i+n-1)%n]) {
        int cur = (i+n-1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d,val));
            cur--;
            if(cur == 0) cur = n-1;
            d++;
        }
    }
    M00(i, n) dbg(block[i] _ distBlock[i].f _ distBlock[i].s);
    M00(i, n) {
        if(block[i]) cout << to(s[i]);
        else {
            if(distBlock[i].f <= k) cout << to(distBlock[i].s);
            else {
                if(k%2 == 0) cout << to(s[i]);
                else cout << notto(s[i]);
            }
        }
    }
    cout << "\n";
}


#include <bits/stdc++.h>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) //cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 200200;
int n, k;
string s;
bool block[MAX_N];
pair<int,char> distBlock[MAX_N]; // (distance, value)

char to(char k) {
    return (k == '0') ? 'W' : 'B';
}

char notto(char k) {
    return (k == '0') ? 'B' : 'W';
}

int main() { FAST
    cin >> n >> k >> s;
    M00(i, n) s[i] = (s[i] == 'B') ? '1' : '0';
    M00(i, n) if(s[i] == s[(i+n-1)%n] || s[i] == s[(i+1)%n]) block[i] = 1;
    M00(i, n) distBlock[i] = mp(1e9, '?');
    M00(i, n) if(block[i] && !block[(i+1)%n]) {
        int cur = (i+1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d, val));
            cur++;
            if(cur == n) cur = 0;
            d++;
        }
    }
    M00(i, n) if(block[i] && !block[(i+n-1)%n]) {
        int cur = (i+n-1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d,val));
            cur--;
            if(cur == 0) cur = n-1;
            d++;
        }
    }
    M00(i, n) dbg(distBlock[i].f _ distBlock[i].s);
    M00(i, n) {
        if(block[i]) cout << to(s[i]);
        else {
            if(distBlock[i].f <= k) cout << to(distBlock[i].s);
            else {
                if(k%2 == 0) cout << to(s[i]);
                else cout << notto(s[i]);
            }
        }
    }
    cout << "\n";
}


#include <bits/stdc++.h>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for(int i=a; i<b; i++)
#define M00(i, a) for(int i=0; i<a; i++)
#define MOOd(i,a,b) for(int i = (b)-1; i >= a; i--)
#define M00d(i,a) for(int i = (a)-1; i>=0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define //dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _ << " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef complex<ld> cd;

const int MAX_N = 200200;
int n, k;
string s;
bool block[MAX_N];
pair<int,char> distBlock[MAX_N]; // (distance, value)

char to(char k) {
    return (k == '0') ? 'W' : 'B';
}

char notto(char k) {
    return (k == '0') ? 'B' : 'W';
}

int main() { FAST
    cin >> n >> k >> s;
    M00(i, n) s[i] = (s[i] == 'B') ? '1' : '0';
    M00(i, n) if(s[i] == s[(i+n-1)%n] || s[i] == s[(i+1)%n]) block[i] = 1;
    M00(i, n) distBlock[i] = mp(1e9, '?');
    M00(i, n) if(block[i] && !block[(i+1)%n]) {
        int cur = (i+1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d, val));
            cur++;
            if(cur == n) cur = 0;
            d++;
        }
    }
    M00(i, n) if(block[i] && !block[(i+n-1)%n]) {
        int cur = (i+n-1)%n;
        int d = 1;
        char val = s[i];
        while(!block[cur]) {
            distBlock[cur] = min(distBlock[cur], mp(d,val));
            cur--;
            if(cur == 0) cur = n-1;
            d++;
        }
    }
    M00(i, n) dbg(distBlock[i].f _ distBlock[i].s);
    M00(i, n) {
        if(block[i]) cout << to(s[i]);
        else {
            if(distBlock[i].f <= k) cout << to(distBlock[i].s);
            else {
                if(k%2 == 0) cout << to(s[i]);
                else cout << notto(s[i]);
            }
        }
    }
    cout << "\n";
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define ordered_set tree <ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
const ll L = 2e5 + 5;
ll arr[L];
void pr(ll v) {
	if (v == 1)
		cout << "W";
	else
		cout << "B";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, k;
 	cin >> n >> k;
 	string s;
	cin >> s;
 	for (ll i = 0; i < n; i++) {
 		if (s[i] == 'W')
 			arr[i] = 1;
 		else
 			arr[i] = 0;
 	}
 	ll ind;
 	for (ind = 1; ind < n; ind++) {
 		if (arr[ind] != arr[ind - 1])
 			break;
 	}
 	if (ind == n) {
 		cout << s << endl;
 		return 0;
 	}
 	vector <ll> v;
 	for (ll i = ind; i < n; i++) {
 		v.pb(arr[i]);
 	}
 	for (ll i = 0; i < ind; i++) {
 		v.pb(arr[i]);
 	}
 	ll st = 0;
 	ll c = 1;
 	ll f = 0;
 	vector <ll> ch;
 	for (ll i = 1; i < n + 1; i++) {
 		if (i == n + 1 || v[i] != v[i - 1]) {
 			ll e = i - 1;
			if (c > 1) {
				ch.pb(st);
				ch.pb(e);
			}
			f = 0;
			c = 1;
 		}
 		else if (v[i] == v[i - 1] && f == 0) {
 			f = 1;
 			st = i - 1;
 			c++;
 		}
 		else if (v[i] == v[i - 1]) {
 			c++;
 		}
 	}
 	if (sz(ch) == 0) {
 		if (k % 2 == 0) {
 			cout << s << endl;
 		}
 		else {
 			for (ll i = 0; i < n; i++) {
 				if (s[i] == 'B')
 					cout << 'W';
 				else
 					cout << 'B';
 			}
 			cout << endl;
 		}
 		return 0;
 	}
 	vector <ll> ne;
 	for (ll i = 1; i < sz(ch); i++)
 		ne.pb(ch[i]);
 	ne.pb(ch[0]);
	for (ll i = 0; i < sz(ne); i+=2) {
		ll l = ne[i];
		ll r = ne[i + 1];
		ll eles = r - l - 1;
		if (r < l) {
			eles = n - 1 - l + r;
		}
		ll req = eles / 2;
		ll p = v[l];
		ll q = v[r];
		if (eles % 2 != 0)
			req++;
		if (k >= req) {
			if (eles % 2 != 0) {
				ll j = (l + 1) % n;
				ll p = v[l];
				ll c = 0;
				while (c < eles) {
					v[j] = p;
					j += 1;
					j = j % n;
					c++;
				}
			}
			else {
				ll x = (l + 1) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = p;
					x += 1;
					x = x % n;
				}
				x = (r - 1 + n) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = q;
					x -= 1;
					if (x < 0)
						x = n - 1;
				}
			}
		}
		else {
			ll j = (l + 1) % n;
			ll c = 0;
			while (c < req) {
				v[j] = p;
				j++;
				if (j == n)
					j = 0;
				c++;
			}
			j = (r -  1 + n) % n;
			c = 0;
			while (c < req) {
				v[j] = q;
				j--;
				if (j == -1)
					j = n - 1;
				c++;
			}
			if (k % 2 == 1) {
				ll start = (l + req + 1) % n;
				c = 0;
				while (c < eles - req) {
					v[c] = 1 - v[c];
					start++;
					start = start % n;
				}
			}
		}
	}
	vector <ll> final;
	for (ll i = n - ind; i < n; i++)
		pr(v[i]);
	for (ll i = 0; i < n - ind; i++)
		pr(v[i]);
	cout << endl;
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define ordered_set tree <ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
const ll L = 2e5 + 5;
ll arr[L];
void pr(ll v) {
	if (v == 1)
		cout << "W";
	else
		cout << "B";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, k;
 	cin >> n >> k;
 	string s;
	cin >> s;
 	for (ll i = 0; i < n; i++) {
 		if (s[i] == 'W')
 			arr[i] = 1;
 		else
 			arr[i] = 0;
 	}
 	ll ind;
 	for (ind = 1; ind < n; ind++) {
 		if (arr[ind] != arr[ind - 1])
 			break;
 	}
 	if (ind == n) {
 		cout << s << endl;
 		return 0;
 	}
 	vector <ll> v;
 	for (ll i = ind; i < n; i++) {
 		v.pb(arr[i]);
 	}
 	for (ll i = 0; i < ind; i++) {
 		v.pb(arr[i]);
 	}
 	ll st = 0;
 	ll c = 1;
 	ll f = 0;
 	vector <ll> ch;
 	for (ll i = 1; i < n + 1; i++) {
 		if (i == n || v[i] != v[i - 1]) {
 			ll e = i - 1;
			if (c > 1) {
				ch.pb(st);
				ch.pb(e);
			}
			f = 0;
			c = 1;
 		}
 		else if (v[i] == v[i - 1] && f == 0) {
 			f = 1;
 			st = i - 1;
 			c++;
 		}
 		else if (v[i] == v[i - 1]) {
 			c++;
 		}
 	}
 	if (sz(ch) == 0) {
 		if (k % 2 == 0) {
 			cout << s << endl;
 		}
 		else {
 			for (ll i = 0; i < n; i++) {
 				if (s[i] == 'B')
 					cout << 'W';
 				else
 					cout << 'B';
 			}
 			cout << endl;
 		}
 		return 0;
 	}
 	vector <ll> ne;
 	for (ll i = 1; i < sz(ch); i++)
 		ne.pb(ch[i]);
 	ne.pb(ch[0]);
	for (ll i = 0; i < sz(ne); i+=2) {
		ll l = ne[i];
		ll r = ne[i + 1];
		ll eles = r - l - 1;
		if (r < l) {
			eles = n - 1 - l + r;
		}
		ll req = eles / 2;
		ll p = v[l];
		ll q = v[r];
		if (eles % 2 != 0)
			req++;
		if (k >= req) {
			if (eles % 2 != 0) {
				ll j = (l + 1) % n;
				ll p = v[l];
				ll c = 0;
				while (c < eles) {
					v[j] = p;
					j += 1;
					j = j % n;
					c++;
				}
			}
			else {
				ll x = (l + 1) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = p;
					x += 1;
					x = x % n;
				}
				x = (r - 1 + n) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = q;
					x -= 1;
					if (x < 0)
						x = n - 1;
				}
			}
		}
		else {
			ll j = (l + 1) % n;
			ll c = 0;
			while (c < req) {
				v[j] = p;
				j++;
				if (j == n)
					j = 0;
				c++;
			}
			j = (r -  1 + n) % n;
			c = 0;
			while (c < req) {
				v[j] = q;
				j--;
				if (j == -1)
					j = n - 1;
				c++;
			}
			if (k % 2 == 1) {
				ll start = (l + req + 1) % n;
				c = 0;
				while (c < eles - req) {
					v[c] = 1 - v[c];
					start++;
					start = start % n;
				}
			}
		}
	}
	vector <ll> final;
	for (ll i = n - ind; i < n; i++)
		pr(v[i]);
	for (ll i = 0; i < n - ind; i++)
		pr(v[i]);
	cout << endl;
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define ordered_set tree <ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
const ll L = 2e5 + 5;
ll arr[L];
void pr(ll v) {
	if (v == 1)
		cout << "W";
	else
		cout << "B";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, k;
 	cin >> n >> k;
 	string s;
	cin >> s;
 	for (ll i = 0; i < n; i++) {
 		if (s[i] == 'W')
 			arr[i] = 1;
 		else
 			arr[i] = 0;
 	}
 	ll ind;
 	for (ind = 1; ind < n; ind++) {
 		if (arr[ind] != arr[ind - 1])
 			break;
 	}
 	if (ind == n) {
 		cout << s << endl;
 		return 0;
 	}
 	vector <ll> v;
 	for (ll i = ind; i < n; i++) {
 		v.pb(arr[i]);
 	}
 	for (ll i = 0; i < ind; i++) {
 		v.pb(arr[i]);
 	}
 	ll st = 0;
 	ll c = 1;
 	ll f = 0;
 	vector <ll> ch;
 	for (ll i = 1; i < n + 1; i++) {
 		if (i == n || v[i] != v[i - 1]) {
 			ll e = i - 1;
			if (c > 1) {
				ch.pb(st);
				ch.pb(e);
			}
			f = 0;
			c = 1;
 		}
 		else if (v[i] == v[i - 1] && f == 0) {
 			f = 1;
 			st = i - 1;
 			c++;
 		}
 		else if (v[i] == v[i - 1]) {
 			c++;
 		}
 	}
 	if (sz(ch) == 0) {
 		if (k % 2 == 0) {
 			cout << s << endl;
 		}
 		else {
 			for (ll i = 0; i < n; i++) {
 				if (s[i] == 'B')
 					cout << 'W';
 				else
 					cout << 'B';
 			}
 			cout << endl;
 		}
 		return 0;
 	}
 	vector <ll> ne;
 	for (ll i = 1; i < sz(ch); i++)
 		ne.pb(ch[i]);
 	ne.pb(ch[0]);
	for (ll i = 0; i < sz(ne); i+=2) {
		ll l = ne[i];
		ll r = ne[i + 1];
		ll eles = r - l - 1;
		if (r < l) {
			eles = n - 1 - l + r;
		}
		ll req = eles / 2;
		ll p = v[l];
		ll q = v[r];
		if (eles % 2 != 0)
			req++;
		if (k >= req) {
			if (eles % 2 != 0) {
				ll j = (l + 1) % n;
				ll p = v[l];
				ll c = 0;
				while (c < eles) {
					v[j] = p;
					j += 1;
					j = j % n;
					c++;
				}
			}
			else {
				ll x = (l + 1) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = p;
					x += 1;
					x = x % n;
				}
				x = (r - 1 + n) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = q;
					x -= 1;
					if (x < 0)
						x = n - 1;
				}
			}
		}
		else {
			ll j = (l + 1) % n;
			ll c = 0;
			ll temp = k;
			while (c < temp) {
				v[j] = p;
				j++;
				if (j == n)
					j = 0;
				c++;
			}
			j = (r -  1 + n) % n;
			c = 0;
			while (c < temp) {
				v[j] = q;
				j--;
				if (j == -1)
					j = n - 1;
				c++;
			}
			if (k % 2 == 1) {
				ll start = (l + temp + 1) % n;
				c = 0;
				while (c < eles - temp) {
					v[c] = 1 - v[c];
					start++;
					start = start % n;
				}
			}
		}
	}
	vector <ll> final;
	for (ll i = n - ind; i < n; i++)
		pr(v[i]);
	for (ll i = 0; i < n - ind; i++)
		pr(v[i]);
	cout << endl;
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define ordered_set tree <ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k - 1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
const ll L = 2e5 + 5;
ll arr[L];
void pr(ll v) {
	if (v == 1)
		cout << "W";
	else
		cout << "B";
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, k;
 	cin >> n >> k;
 	string s;
	cin >> s;
 	for (ll i = 0; i < n; i++) {
 		if (s[i] == 'W')
 			arr[i] = 1;
 		else
 			arr[i] = 0;
 	}
 	ll ind;
 	for (ind = 1; ind < n; ind++) {
 		if (arr[ind] != arr[ind - 1])
 			break;
 	}
 	if (ind == n) {
 		cout << s << endl;
 		return 0;
 	}
 	vector <ll> v;
 	for (ll i = ind; i < n; i++) {
 		v.pb(arr[i]);
 	}
 	for (ll i = 0; i < ind; i++) {
 		v.pb(arr[i]);
 	}
 	ll st = 0;
 	ll c = 1;
 	ll f = 0;
 	vector <ll> ch;
 	for (ll i = 1; i < n + 1; i++) {
 		if (i == n || v[i] != v[i - 1]) {
 			ll e = i - 1;
			if (c > 1) {
				ch.pb(st);
				ch.pb(e);
			}
			f = 0;
			c = 1;
 		}
 		else if (v[i] == v[i - 1] && f == 0) {
 			f = 1;
 			st = i - 1;
 			c++;
 		}
 		else if (v[i] == v[i - 1]) {
 			c++;
 		}
 	}
 	if (sz(ch) == 0) {
 		if (k % 2 == 0) {
 			cout << s << endl;
 		}
 		else {
 			for (ll i = 0; i < n; i++) {
 				if (s[i] == 'B')
 					cout << 'W';
 				else
 					cout << 'B';
 			}
 			cout << endl;
 		}
 		return 0;
 	}
 	vector <ll> ne;
 	for (ll i = 1; i < sz(ch); i++)
 		ne.pb(ch[i]);
 	ne.pb(ch[0]);
	for (ll i = 0; i < sz(ne); i+=2) {
		ll l = ne[i];
		ll r = ne[i + 1];
		ll eles = r - l - 1;
		if (r < l) {
			eles = n - 1 - l + r;
		}
		ll req = eles / 2;
		ll p = v[l];
		ll q = v[r];
		if (eles % 2 != 0)
			req++;
		if (k >= req) {
			if (eles % 2 != 0) {
				ll j = (l + 1) % n;
				ll p = v[l];
				ll c = 0;
				while (c < eles) {
					v[j] = p;
					j += 1;
					j = j % n;
					c++;
				}
			}
			else {
				ll x = (l + 1) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = p;
					x += 1;
					x = x % n;
				}
				x = (r - 1 + n) % n;
				for (ll j = 0; j < req; j++) {
					v[x] = q;
					x -= 1;
					if (x < 0)
						x = n - 1;
				}
			}
		}
		else {
			ll j = (l + 1) % n;
			ll c = 0;
			ll temp = k;
			while (c < temp) {
				v[j] = p;
				j++;
				if (j == n)
					j = 0;
				c++;
			}
			j = (r - 1 + n) % n;
			c = 0;
			while (c < temp) {
				v[j] = q;
				j--;
				if (j == -1)
					j = n - 1;
				c++;
			}
			if (k % 2 == 1) {
				ll start = (l + temp + 1) % n;
				c = 0;
				while (c < eles - temp * 2) {
					v[start] = 1 - v[start];
					start++;
					start = start % n;
					c++;
				}
			}
		}
	}
	vector <ll> final;
	for (ll i = n - ind; i < n; i++)
		pr(v[i]);
	for (ll i = 0; i < n - ind; i++)
		pr(v[i]);
	cout << endl;
	return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1] && t[i - 2] != t[i])
            lft[i] = i - 1;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= n - pocz; i--) {
        if (t[i] == t[i + 1] && t[i] != t[i + 2])
            rgt[i] = i + 1;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    /*
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';
    */
    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i - 1 + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1] && t[i - 2] != t[i])
            lft[i] = i - 1;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= n - pocz; i--) {
        if (t[i] == t[i + 1] && t[i] != t[i + 2])
            rgt[i] = i + 1;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    return 0;
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';

    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i - 1 + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

#define f first
#define s second

const int MAXN = 4e5 + 3;
const int INF = 1e9 + 3;

char b[MAXN];
char w[MAXN];
int ans[MAXN];

char rev(char ch) {
    return ch == 'W' ? 'B' : 'W';
}

void wypisz(int x, int n, int k) {
    for (int i = x; i < x + n; i++) {
        if (ans[i] <= k) {
            if (ans[i] & 1)
                w[i] = rev(b[i]);
            else
                w[i] = b[i];
        }
        else if (k & 1)
            w[i] = rev(b[i]);
        else
            w[i] = b[i];
    }
    for (int i = x - 1; i > 0; i--)
        w[i] = w[i + n];
    for (int i = 1; i <= n; i++)
        printf("%c", w[i]);
}

int main() {
    int n, k, pocz;
    scanf("%d %d ", &n, &k);
    for (int i = 1; i <= n; i++)
        scanf("%c", &b[i]);
    b[0] = b[n];
    for (int i = n + 1; i <= 2 * n; i++)
        b[i] = b[i - n];
    pocz = -1;
    for (int i = 1; i <= n; i++) {
        if (b[i] == b[i - 1]) {
            pocz = i;
            break;
        }
    }
    if (pocz == -1) {
        for (int i = 1; i <= n; i++)
            ans[i] = INF;
        wypisz(1, n, k);
        return 0;
    }
    int kon = pocz - 1;
    int pnt = pocz;
    int tm;
    for (int i = pocz; i <= pocz + n; i++) {
        if (b[i] == b[i - 1]) {
            if (kon != i - 1) {
                kon++;
                pnt--;
                tm = 0;
                while (kon <= pnt) {
                    tm++;
                    ans[kon] = ans[pnt] = tm;
                    kon++;
                    pnt--;
                }
            }
            kon = pnt = i;
            continue;
        }
        pnt++;
    }
    wypisz(pocz, n, k);
    return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1] && t[i - 2] != t[i])
            lft[i] = i - 1;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= pocz - n; i--) {
        if (t[i] == t[i + 1] && t[i] != t[i + 2])
            rgt[i] = i + 1;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    /*
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';
    */
    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i - 1 + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1])
            lft[i] = i;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= pocz - n; i--) {
        if (t[i] == t[i + 1])
            rgt[i] = i;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    /*
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';
    */
    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    return 0;
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1] && t[i - 2] != t[i])
            lft[i] = i - 1;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= n - pocz; i--) {
        if (t[i] == t[i + 1] && t[i] != t[i + 2])
            rgt[i] = i + 1;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    /*
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';
    */
    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i - 1 + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


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

using namespace std;

#define f first
#define s second

const int MAXN = 2e5 + 3;

bool t[2 * MAXN];
int lft[2 * MAXN];
int rgt[2 * MAXN];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'B')
            t[i + 1] = t[i + n + 1] = true;
    }
    bool win = false;
    int pocz = 0;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i + 1]) {
            win = true;
            pocz = i;
            break;
        }
    }
    if (!win) {
        if (k & 1) {
            for (int i = 1; i <= n; i++) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            for (int i = 1; i <= n; i++) {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        return 0;
    }
    lft[pocz] = pocz;
    for (int i = pocz + 1; i <= n + pocz; i++) {
        if (t[i] == t[i - 1])
            lft[i] = i;
        else
            lft[i] = lft[i - 1];
    }
    t[0] = t[n];
    for (int i = n; i > 0; i--) {
        if (t[i] == t[i - 1]) {
            pocz = i;
            break;
        }
    }
    pocz += n;
    rgt[pocz] = pocz;
    for (int i = pocz - 1; i >= pocz - n; i--) {
        if (t[i] == t[i + 1])
            rgt[i] = i;
        else
            rgt[i] = rgt[i + 1];
    }
    for (int i = 1; i <= n; i++) {
        if (lft[i] == 0)
            lft[i] = lft[i + n];
        if (rgt[i] == 0)
            rgt[i] = rgt[i + n];
        while (lft[i] > n)
            lft[i] -= n;
        while (rgt[i] > n)
            rgt[i] -= n;
    }
    /*
    for (int i = 1; i <= n; i++)
        cout << lft[i] << ' ';
    cout << '\n';
    for (int i = 1; i <= n; i++)
        cout << rgt[i] << ' ';
    cout << '\n';
    */
    int x, y;
    for (int i = 1; i <= n; i++) {
        if (t[i] == t[i - 1] || t[i] == t[i + 1]) {
            if (t[i])
                cout << "B";
            else
                cout << "W";
            continue;
        }
        if (rgt[i] >= i)
            x = rgt[i] - i;
        else
            x = n - i + rgt[i] - 1;
        if (lft[i] <= i)
            y = i - lft[i];
        else
            y = i - 1 + n - lft[i];
        if (x > k && y > k) {
            if (k & 1) {
                if (t[i])
                    cout << "W";
                else
                    cout << "B";
            }
            else {
                if (!t[i])
                    cout << "W";
                else
                    cout << "B";
            }
        }
        else {
            if (x < y) {
                if (t[rgt[i]])
                    cout << "B";
                else
                    cout << "W";
            }
            else {
                if (t[lft[i]])
                    cout << "B";
                else
                    cout << "W";
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
int n;
int to(int a,int b)
{
    return min(abs(a-b),min(abs(b+n-a),abs(a+n-b)));
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector <pair<int,int> > a;
    vector <int> b(n);
    int sum1=0;
    int sum2=0;
    for(int i=0;i<n;++i)
    {
        if(s[i]=='W')
        {
            b[i]=0;
            ++sum1;
        }
        else
        {
            b[i]=1;
            ++sum2;
        }
    }
    int curr,left;
    curr=b[0];
    left=0;
    for(int i=1;i<n;++i)
    {
        if(i==(n-1) || b[i]!=b[i-1])
        {
            if((i-left)!=1 || (i==(n-1) && left!=i && b[i]==b[i-1]))
            {
                if(i==(n-1) && b[i]==b[i-1])
                {
                    a.push_back({left,i});
                }
                else
                {
                a.push_back({left,i-1});
                }
            }
            left=i;
        }
        curr=b[i];
    }
    /*for(int i=0;i<a.size();++i)
    {
        cout<<a[i].first<<" "<<a[i].second<<endl;
    }*/
    pair <int,int> u;
    if(sum1==n)
    {
        for(int i=0;i<n;++i)
        {
            cout<<"W";
        }
        return 0;
    }
    if(sum2==n)
    {
        for(int i=0;i<n;++i)
        {
            cout<<"B";
        }
        return 0;
    }
    if(b[n-1]==b[0])
    {
        if(a.size()==0)
        {
            a.push_back({n-1,0});
        }
        else if(a.size()>=1 && a[a.size()-1].second==(n-1) && a[0].first==0)
        {
            u.first=a[a.size()-1].first;
            u.second=a[0].second;
            a.erase(a.begin());
            a.erase(a.begin()+a.size()-1);
            a.push_back(u);
        }
        else if(a[a.size()-1].second==(n-1))
        {
            a[a.size()-1].second=0;
        }
        else if(a[0].first==0)
        {
            a[0].first==(n-1);
        }
    }
    if(a.size()==0)
    {
        if(k%2==0)
        {
            cout<<s;
            return 0;
        }
        else
        {
            for(int i=0;i<n;++i)
            {
                if(s[i]=='W')
                {
                    cout<<"B";
                }
                else
                {
                    cout<<"W";
                }
            }
            return 0;
        }
    }
    sort(a.begin(),a.end());
    vector <pair<int,int> > c(a.size());
    for(int i=0;i<a.size();++i)
    {
        c[i]={a[i].second,a[i].first};
    }
    vector <int> ans(n);
    int t;
    int pl1,pl2;
    int x1,x2;
    for(int i=0;i<n;++i)
    {
        t=i;
        pl1=lower_bound(a.begin(),a.end(),make_pair(t,(long long) (1000000000)))-a.begin();
        pl2=lower_bound(c.begin(),c.end(),make_pair(t,(long long) (-1)))-c.begin();
        if((pl1%a.size())!=(pl2%a.size()))
        {
            ans[i]=b[i];
            continue;
        }
        if(pl1!=a.size())
        {
            x2=a[pl1].first;
        }
        else
        {
            x2=a[0].first;
        }
        if(pl1!=0)
        {
            x1=a[pl1-1].second;
        }
        else
        {
            x1=a[a.size()-1].second;
        }
        // cout<<i<<" "<<x1<<" "<<x2<<endl;
        if(min(to(i,x1),to(i,x2))<=k)
        {
            if(to(i,x1)<to(i,x2))
            {
                ans[i]=b[x1];
                continue;
            }
            else
            {
                ans[i]=b[x2];
                continue;
            }
        }
        else
        {
            ans[i]=(b[i]+k)%2;
        }
    }
    for(int i=0;i<n;++i)
    {
        if(ans[i]==0)
        {
            cout<<"W";
        }
        else
        {
            cout<<"B";
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
int n;
int to(int a,int b)
{
    return min(abs(a-b),min(abs(b+n-a),abs(a+n-b)));
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int k;
    cin>>n>>k;
    string s;
    cin>>s;
    vector <pair<int,int> > a;
    vector <int> b(n);
    int sum1=0;
    int sum2=0;
    for(int i=0;i<n;++i)
    {
        if(s[i]=='W')
        {
            b[i]=0;
            ++sum1;
        }
        else
        {
            b[i]=1;
            ++sum2;
        }
    }
    int curr,left;
    curr=b[0];
    left=0;
    for(int i=1;i<n;++i)
    {
        if(i==(n-1) || b[i]!=b[i-1])
        {
            if((i-left)!=1 || (i==(n-1) && left!=i && b[i]==b[i-1]))
            {
                if(i==(n-1) && b[i]==b[i-1])
                {
                    a.push_back({left,i});
                }
                else
                {
                a.push_back({left,i-1});
                }
            }
            left=i;
        }
        curr=b[i];
    }
    /*for(int i=0;i<a.size();++i)
    {
        cout<<a[i].first<<" "<<a[i].second<<endl;
    }*/
    pair <int,int> u;
    if(sum1==n)
    {
        for(int i=0;i<n;++i)
        {
            cout<<"W";
        }
        return 0;
    }
    if(sum2==n)
    {
        for(int i=0;i<n;++i)
        {
            cout<<"B";
        }
        return 0;
    }
    if(b[n-1]==b[0])
    {
        if(a.size()==0)
        {
            a.push_back({n-1,0});
        }
        else if(a.size()>=1 && a[a.size()-1].second==(n-1) && a[0].first==0)
        {
            u.first=a[a.size()-1].first;
            u.second=a[0].second;
            a.erase(a.begin());
            a.erase(a.begin()+a.size()-1);
            a.push_back(u);
        }
        else if(a[a.size()-1].second==(n-1))
        {
            a[a.size()-1].second=0;
        }
        else if(a[0].first==0)
        {
            a[0].first==(n-1);
        }
    }
    if(a.size()==0)
    {
        if(k%2==0)
        {
            cout<<s;
            return 0;
        }
        else
        {
            for(int i=0;i<n;++i)
            {
                if(s[i]=='W')
                {
                    cout<<"B";
                }
                else
                {
                    cout<<"W";
                }
            }
            return 0;
        }
    }
    sort(a.begin(),a.end());
    vector <pair<int,int> > c(a.size());
    for(int i=0;i<a.size();++i)
    {
        c[i]={a[i].second,a[i].first};
    }
    vector <int> ans(n);
    int t;
    int pl1,pl2;
    int x1,x2;
    for(int i=0;i<n;++i)
    {
        t=i;
        pl1=lower_bound(a.begin(),a.end(),make_pair(t,(long long) (1000000000)))-a.begin();
        pl2=lower_bound(a.begin(),a.end(),make_pair(t,(long long) (-1)))-a.begin();
        if(pl1!=pl2)
        {
            ans[i]=b[i];
            continue;
        }
        if(pl1!=a.size())
        {
            x2=a[pl1].first;
        }
        else
        {
            x2=a[0].first;
        }
        if(pl1!=0)
        {
            x1=a[pl1-1].second;
        }
        else
        {
            x1=a[a.size()-1].second;
        }
        // cout<<i<<" "<<x1<<" "<<x2<<endl;
        if(min(to(i,x1),to(i,x2))<=k)
        {
            if(to(i,x1)<to(i,x2))
            {
                ans[i]=b[x1];
                continue;
            }
            else
            {
                ans[i]=b[x2];
                continue;
            }
        }
        else
        {
            ans[i]=(b[i]+k)%2;
        }
    }
    for(int i=0;i<n;++i)
    {
        if(ans[i]==0)
        {
            cout<<"W";
        }
        else
        {
            cout<<"B";
        }
    }
    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    string str;
    cin>>str;
    int numW = 0, numB = 0;
    for(int i = 0; i < n; i++){
    	if(str[i] == 'B')
    		numB++;
    	else
    		numW++;
    }

    if(numB == 0 || numW == 0){
    	cout<<0<<"\n";
    	return 0;
    }

    if(n%2 == 0 && numW%2 == 1){
    	cout<<-1<<"\n";
    	return 0;
    }

    vi ans;
    int i = 0;
    while(true){
    	ans.pb(i+1);
    	if(str[i] == 'B'){
    		numB--;
    		numW++;
    		str[i] = 'W';
    	}else{
    		numW--;
    		numB++;
    		str[i] = 'B';
    	}

        if(str[i+1] == 'B'){
    		numB--;
    		numW++;
    		str[i+1] = 'W';
    	}else{
    		numW--;
    		numB++;
    		str[i+1] = 'B';
    	}

    	if(numB == 0 || numW == 0)
    		break;

    	i++;
    	if(i == n-1)
    		i = 0;

    }

    cout<<ans.size()<<"\n";
    for(int i: ans)
    	cout<<i<<" ";

    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    string str;
    cin>>str;
    int numW = 0, numB = 0;
    for(int i = 0; i < n; i++){
    	if(str[i] == 'B')
    		numB++;
    	else
    		numW++;
    }

    if(numB == 0 || numW == 0){
    	cout<<0<<"\n";
    	return 0;
    }

    vi ans;
    int i = 0;
    char c = 'B';
    while(true){
    	ans.pb(i+1);
    	if(str[i] != c){
    		 numW--;
    		 numB++;
    		 str[i] = 'B';

           if(str[i+1] == 'B'){
    		 numB--;
    		 numW++;
    		 str[i+1] = 'W';
    	   }else{
    		 numW--;
    		 numB++;
    		 str[i+1] = 'B';
    	   }
    	}

    	if(numB == 0 || numW == 0)
    		break;

        if(ans.size() > 3*n)
           break;

    	i++;
    	if(i == n-1)
    		i = 0;

    }

    if(numB == 0 || numW == 0){
        cout<<ans.size()<<"\n";
        for(int i: ans)
     	   cout<<i<<" ";
    }else
           cout<<-1<<"\n";

    return 0;
}


#include <bits/stdc++.h>  // This will work only for g++ compiler.
#include <ext/pb_ds/assoc_container.hpp> // Used to include policy based data structure
using namespace __gnu_pbds;  // Only for g++ compiler
using namespace std;

#define for0(i, n) for (int i = 0; i < (int)(n); ++i) // 0 based indexing
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i) // 1 based indexing
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) // closed interver from l to r r inclusive
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i) // reverse 0 based.
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i) // reverse 1 based
#define max(a, b)  (a > b) ?a :b  // max of 2 elements
#define min(a, b)  (a < b) ?a :b  // min of 2 elements

//short hand for usual tokens
#define pb              push_back
#define fi              first
#define se              second
#define mp              make_pair
#define mii             map<int,int>
#define pqb             priority_queue<int>   // Max Heap
#define pqs             priority_queue<int,vi,greater<int> >   // Min Heap
#define setbits(x)      __builtin_popcountll(x)   // returns the number of set bits in the binary representation of x
#define zrobits(x)      __builtin_ctzll(x)   // returns the number of zeroes before the first set bit in the binary representation of x
#define mod             1000000007   // 1e9 + 7
#define inf             1e18   // pow(10, 18)
#define mk(arr,n,type)  type *arr=new type[n];   // generates a dynamic array
#define w(x)            int x; cin>>x; while(x--)   // for taking test cases
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());   // used with shuffle

// to be used with algorithms that processes a container Eg: find(all(c),42)
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

// traversal function to avoid long template definition. Now with C++11 auto alleviates the pain.
#define tr(c,i) for(__typeof__((c)).begin() i = (c).begin(); i != (c).end(); i++)

// find if a given value is present in a container. Container version. Runs in log(n) for set and map
#define present(c,x) ((c).find(x) != (c).end())

//find version works for all containers. This is present in std namespace.
#define cpresent(c,x) (find(all(c),x) != (c).end())

// Avoiding wrap around of size()-1 where size is a unsigned int.
#define sz(a) int((a).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;   // Used to implement policy-based data structure

// Shorthand for commonly used types
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin>>n;
    string str;
    cin>>str;
    int numW = 0, numB = 0;
    for(int i = 0; i < n; i++){
    	if(str[i] == 'B')
    		numB++;
    	else
    		numW++;
    }

    if(numB == 0 || numW == 0){
    	cout<<0<<"\n";
    	return 0;
    }

    vi ans;
    int i = 0;
    while(true){
    	ans.pb(i+1);
    	if(str[i] == 'B'){
    		numB--;
    		numW++;
    		str[i] = 'W';
    	}else{
    		numW--;
    		numB++;
    		str[i] = 'B';
    	}

        if(str[i+1] == 'B'){
    		numB--;
    		numW++;
    		str[i+1] = 'W';
    	}else{
    		numW--;
    		numB++;
    		str[i+1] = 'B';
    	}

    	if(numB == 0 || numW == 0)
    		break;

        if(ans.size() > 3*n)
           break;

    	i++;
    	if(i == n-1)
    		i = 0;

    }

    if(numB == 0 || numW == 0){
        cout<<ans.size()<<"\n";
        for(int i: ans)
     	   cout<<i<<" ";
    }else
           cout<<-1<<"\n";

    return 0;
}


#include <bits/stdc++.h>
//#define x first
#define y second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false);
#define getfiles ifstream cin("input.txt");ofstream cout("output.txt");
#define closefiles cin.close();cout.close();
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
using namespace std;
struct nn{
    ll x;
    ll y=0;
};
bool cmp(nn a,nn b){
    return a.x<b.x;
}

int main()
{
    fast_io;
    ll n;
    cin>>n;
    string a;
    cin>>a;
    vector<ll>ans;
    if((a.find('W')==string::npos && a.find('B')!=string::npos)|| (a.find('W')!=string::npos && a.find('B')==string::npos)){
        cout<<0;
        return 0;
    }
    if(a=="BWB" || a=="WBW"){
        cout<<2<<endl;
        cout<<2<<" "<<1;
        return 0;
    }
    vector<ll> b;
    vector<ll> w;
    for(int i=0;i<a.length();i++){
        if(a[i]=='B'){
            b.push_back(i);
        }
        else{
            w.push_back(i);
        }
    }
    if(b[b.size()-1]==w[0]-1){
        for(ll j=0;j<b.size()-1;j++){
            a[b[j]]='W';
            a[b[j+1]]='W';
            ans.push_back(b[j]+1);
            j++;
        }
    }
    else if(w[w.size()-1]==b[0]-1){
        for(ll j=0;j<w.size()-1;j++){
            a[w[j]]='B';
            a[w[j+1]]='B';
            ans.push_back(w[j]+1);
            j++;
        }
    }
    else{
        for(ll j=0;j<b.size()-1;j++){
            if(b[j]==b[j+1]-1){
            a[b[j]]='W';
            a[b[j+1]]='W';
            ans.push_back(b[j]+1);
            j++;
            }
        }
        for(ll j=0;j<w.size()-1;j++){
            if(w[j]==w[j+1]-1){
            a[w[j]]='B';
            a[w[j+1]]='B';
            ans.push_back(w[j]+1);
            j++;
            }
        }
    }
    if((a.find('W')==string::npos && a.find('B')!=string::npos)|| (a.find('W')!=string::npos && a.find('B')==string::npos)){
            cout<<ans.size()<<endl;
            for(ll i=0;i<ans.size();i++){
                cout<<ans[i]<<" ";
            }
    }
    else{
        cout<<-1;
    }
    return 0;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define vi_a vector<int>a;
#define p_b push_back
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define getfiles ifstream cin("input.txt");ofstream cout("output.txt");
#define closefiles cin.close();cout.close();
#define all(x) x.begin(),x.end()
#define sset ordered_set
#define sqr(x) (x)*(x)
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
using namespace std;

int main()
{
    ll n;
    cin>>n;
    string a;
    cin>>a;
    vector<bool>b(n);
    ll black=0,white=0;
    for(int i=0;i<n;i++){

        if(a[i]=='B'){ black++; b[i]=1;}
        else {white++; b[i]=0;}
    }
    if(white%2==1 && black%2==1){
        cout<<"-1"<<endl;
    }
    else if(white%2==1 && black%2==0){
        vector<ll>ans;
        for(int i=0;i<n-1;i++){
            if(b[i]==1){
                b[i]=0;
                b[i+1]=!b[i+1];
                ans.push_back(i+1);
            }
        }
        cout<<ans.size()<<endl;
        for(ll l=0;l<ans.size();l++){
            cout<<ans[l]<<" ";
        }
    }
    else{
        vector<ll>ans;
        for(int i=0;i<n-1;i++){
            if(b[i]==0){
                b[i]=1;
                b[i+1]=!b[i+1];
                ans.push_back(i+1);
            }
        }
        cout<<ans.size()<<endl;
        for(ll l=0;l<ans.size();l++){
            cout<<ans[l]<<" ";
        }
    }
    return 0;
}