stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<cstring>

using namespace std;

int  an[4][2]={{2, 2},{2,1},{1,1},{1,2}};//WW WS SS SW

int i,j,kind[100005],n;

char ans[100005];

int main()

{

    while(cin>>n&&(n>=3))

    {

        int flag=0;

        memset(kind,0,sizeof(kind));

        for(i=1;i<=n;i++)

        {

            cin>>ans[i];

        }



        for(j=0;j<4;j++)

        {

            kind[1]=an[j][0];

            kind[2]=an[j][1];

            for(i=2;i<=n;i++)

            {

             if(kind[i]==2)//is wolf

             {

                 if(ans[i]=='o') kind[i+1]=kind[i-1]%2+1;

                 else kind[i+1]=kind[i-1];

             }

             else if(kind[i]==1)

                 if(ans[i]=='x')  kind[i+1]=kind[i-1]%2+1;

                 else kind[i+1]=kind[i-1];

            }







            if(kind[n+1]==kind[1])

            {





                if(kind[1]==1)

                {

                    if(ans[1]=='o'&&kind[2]==kind[n]){flag++;break;}

                    if(ans[1]=='x'&&kind[2]!=kind[n]){flag++;break;}

                }

                else if(kind[1]==2)

                {

                    if(ans[1]=='x'&&kind[2]==kind[n]){flag++;break;}

                    if(ans[1]=='o'&&kind[2]!=kind[n]){flag++;break;}

                }

            }





        }



        if(flag==0)cout<<"-1"<<endl;

        else

        {





        for(i=1;i<=n;i++)

        {

            if(kind[i]==1)cout<<'S';

            else cout<<'W';

        }

            cout<<endl;

           // cout<<kind[n+1]<<endl;



        }

    }



}


// Faster C++ solution for the same problem (measured speedup: 7.359387328983001x):
#include <cstdio>

#include <cstdlib>



const int MAXN=100011;



int N;

char str[MAXN];



bool isWolf[MAXN];



void Shift(){

	for(int i=2;i<N;++i){

		if(isWolf[i-1]){

			if(str[i-1]=='x')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

		else{

			if(str[i-1]=='o')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

	}

}



bool Test(int a){

	int p=a-1;if(p<0)	p+=N;

	int n=a+1;if(n>=N)	n-=N;

	if(isWolf[a]^(str[a]=='o'))

		return isWolf[p]==isWolf[n];

	return isWolf[p]!=isWolf[n];

}



bool Test(){

	bool ret=true;

	for(int i=0;i<N;++i){

		ret&=Test(i);

	}

	return ret;

}



void Show(){

	for(int i=0;i<N;++i){

		if(isWolf[i])

			printf("W");

		else	printf("S");

	}

	puts("");

	exit(0);

}



int main(){

	

	scanf("%d", &N);

	

	scanf("%s", str);

	

	isWolf[0]=false;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=false;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	puts("-1");

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

#include<cstdio>

#include<algorithm>

#include<queue>

#include<vector>

#include<cmath>

#include<stack>

using namespace std;

bool vis[220010];

char s[220010];

bool check(int x, int y, int len)

{

    vis[0]=x;

    vis[1]=y;

    for(int i=2; i<=len+1; i++)

    {

        if(vis[i-1])

        {

            if(s[i-1]=='o') 

                vis[i]=vis[i-2];

            else 

                vis[i]=!vis[i-2];

        }

        else

        {

            if(s[i-1]=='o') 

                vis[i]=!vis[i-2];

            else 

                vis[i]=vis[i-2];

        }

    }

    if(vis[len]==vis[0]&&vis[len+1]==vis[1])

    {

        for(int i=0;i<len;i++)

        {

            if(vis[i])

                printf("S");

            else

                printf("W");

        }

        puts("");

        return 1;

    }

    return 0;

}

int main()

{

    int n;

    while(scanf("%d",&n)!=EOF)

    {

        scanf("%s",s);

        int len=n;

        s[len]=s[0];

        s[len+1]=s[1];

        s[len+2]='\0';

        bool fl=0;

        for(int i=0;i<2;i++)

        {

            for(int j=0;j<2;j++)

            {

                if(check(i,j,len))

                {

                    fl=1;

                    break;

                }

            }

            if(fl) 

                break;

        }

        if(!fl)

            puts("-1\n");

    }

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.190694147916204x):
#include <cstdio>

#include <cstdlib>



const int MAXN=100011;



int N;

char str[MAXN];



bool isWolf[MAXN];



void Shift(){

	for(int i=2;i<N;++i){

		if(isWolf[i-1]){

			if(str[i-1]=='x')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

		else{

			if(str[i-1]=='o')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

	}

}



bool Test(int a){

	int p=a-1;if(p<0)	p+=N;

	int n=a+1;if(n>=N)	n-=N;

	if(isWolf[a]^(str[a]=='o'))

		return isWolf[p]==isWolf[n];

	return isWolf[p]!=isWolf[n];

}



bool Test(){

	bool ret=true;

	for(int i=0;i<N;++i){

		ret&=Test(i);

	}

	return ret;

}



void Show(){

	for(int i=0;i<N;++i){

		if(isWolf[i])

			printf("W");

		else	printf("S");

	}

	puts("");

	exit(0);

}



int main(){

	

	scanf("%d", &N);

	

	scanf("%s", str);

	

	isWolf[0]=false;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=false;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	puts("-1");

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int n;

char arr[100000];

char brr[100000];

int pd(char a,char b)

{

	brr[0]=a;

	brr[1]=b;

	for(int i=1;i<n-1;i++)

	{

		if(brr[i]=='S'&&arr[i]=='o'||brr[i]=='W'&&arr[i]=='x')

		{

			brr[i+1]=brr[i-1];

		}

		else

		{

			if(brr[i-1]=='S')

			{

				brr[i+1]='W';

			}

			else

			{

				brr[i+1]='S';

			}

		}

	}

	char t;

	if(brr[n-1]=='S'&&arr[n-1]=='o'||brr[n-1]=='W'&&arr[n-1]=='x')

	{

		t=brr[n-2];

	}

	else

	{

		if(brr[n-2]=='S')

		{

			t='W';

		}

		else

		{

			t='S';

		}

	}

	if(t==brr[0])

	{

		if(brr[0]=='S'&&arr[0]=='o'||brr[0]=='W'&&arr[0]=='x')

		{

			if(brr[1]==brr[n-1])

			{

				for(int i=0;i<n;i++)

				{

					cout<<brr[i];

				}

				return 0;

			}

		}

		else

		{

			if(brr[1]!=brr[n-1])

			{

				for(int i=0;i<n;i++)

				{

					cout<<brr[i];

				}

				return 0;

			}

		}

	}

	return 1;

}

int main()

{

	cin>>n;

	for(int i=0;i<n;i++)

	{

		cin>>arr[i];

	}

	char crr[4][2]={'W','W','W','S','S','S','S','W'};

	for(int i=0;i<4;i++)

	{

		if(pd(crr[i][0],crr[i][1])==0)

			return 0;

	}

	cout<<-1;

}

// Faster C++ solution for the same problem (measured speedup: 5.2292579210386725x):
#include <cstdio>

#include <cstdlib>



const int MAXN=100011;



int N;

char str[MAXN];



bool isWolf[MAXN];



void Shift(){

	for(int i=2;i<N;++i){

		if(isWolf[i-1]){

			if(str[i-1]=='x')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

		else{

			if(str[i-1]=='o')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

	}

}



bool Test(int a){

	int p=a-1;if(p<0)	p+=N;

	int n=a+1;if(n>=N)	n-=N;

	if(isWolf[a]^(str[a]=='o'))

		return isWolf[p]==isWolf[n];

	return isWolf[p]!=isWolf[n];

}



bool Test(){

	bool ret=true;

	for(int i=0;i<N;++i){

		ret&=Test(i);

	}

	return ret;

}



void Show(){

	for(int i=0;i<N;++i){

		if(isWolf[i])

			printf("W");

		else	printf("S");

	}

	puts("");

	exit(0);

}



int main(){

	

	scanf("%d", &N);

	

	scanf("%s", str);

	

	isWolf[0]=false;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=false;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	puts("-1");

	

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int zz[100005],n;

char dat[100005];



bool check(){

	if(!((dat[0]=='x')==zz[1]^zz[n-1]^zz[0])) return false;

	if(!((dat[n-1]=='x')==zz[n-2]^zz[n-1]^zz[0])) return false;

	return true;

}



int main(){

	scanf("%d%s",&n,dat);

	

	dat[0];

	

	for(int i=0;i<2;i++){

		for(int j=0;j<2;j++){

			zz[1]=i;

			zz[0]=j;

			for(int k=1;k<n-1;k++)

				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');

			if(check()){

				for(int k=0;k<n;k++) printf("%c",zz[k]?'W':'S');

				return 0;

			}

		}

	}

	

	printf("-1\n");

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.187792130316018x):
#include <cstdio>

#include <cstdlib>



const int MAXN=100011;



int N;

char str[MAXN];



bool isWolf[MAXN];



void Shift(){

	for(int i=2;i<N;++i){

		if(isWolf[i-1]){

			if(str[i-1]=='x')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

		else{

			if(str[i-1]=='o')

				isWolf[i]=isWolf[i-2];

			else	isWolf[i]=!isWolf[i-2];

		}

	}

}



bool Test(int a){

	int p=a-1;if(p<0)	p+=N;

	int n=a+1;if(n>=N)	n-=N;

	if(isWolf[a]^(str[a]=='o'))

		return isWolf[p]==isWolf[n];

	return isWolf[p]!=isWolf[n];

}



bool Test(){

	bool ret=true;

	for(int i=0;i<N;++i){

		ret&=Test(i);

	}

	return ret;

}



void Show(){

	for(int i=0;i<N;++i){

		if(isWolf[i])

			printf("W");

		else	printf("S");

	}

	puts("");

	exit(0);

}



int main(){

	

	scanf("%d", &N);

	

	scanf("%s", str);

	

	isWolf[0]=false;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=false;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=false;

	Shift();

	if(Test())	Show();

	

	isWolf[0]=true;isWolf[1]=true;

	Shift();

	if(Test())	Show();

	

	puts("-1");

	

	return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstring>

using namespace std;

int  an[4][2]={{2, 2},{2,1},{1,1},{1,2}};//WW WS SS SW

int i,j,kind[100005],n;

char ans[100005];

int main()

{

    while(cin>>n&&(n>=3))

    {

        int flag=0;

        memset(kind,0,sizeof(kind));

        for(i=1;i<=n;i++)

        {

            cin>>ans[i];

        }



        for(j=0;j<4;j++)

        {

            kind[1]=an[j][0];

            kind[2]=an[j][1];

            for(i=2;i<=n;i++)

            {

             if(kind[i]==2)//is wolf

             {

                 if(ans[i]=='o') kind[i+1]=kind[i-1]%2+1;

                 else kind[i+1]=kind[i-1];

             }

             else if(kind[i]==1)

                 if(ans[i]=='x')  kind[i+1]=kind[i-1]%2+1;

                 else kind[i+1]=kind[i-1];

            }







            if(kind[n+1]==kind[1])

            {





                if(kind[1]==1)

                {

                    if(ans[1]=='o'&&kind[2]==kind[n]){flag++;break;}

                    if(ans[1]=='x'&&kind[2]!=kind[n]){flag++;break;}

                }

                else if(kind[1]==2)

                {

                    if(ans[1]=='x'&&kind[2]==kind[n]){flag++;break;}

                    if(ans[1]=='o'&&kind[2]!=kind[n]){flag++;break;}

                }

            }





        }



        if(flag==0)cout<<"-1"<<endl;

        else

        {





        for(i=1;i<=n;i++)

        {

            if(kind[i]==1)cout<<'S';

            else cout<<'W';

        }

            cout<<endl;

           // cout<<kind[n+1]<<endl;



        }

    }



}


// Faster C++ solution for the same problem (measured speedup: 1.4181882741297425x):
#include <bits/stdc++.h>

using namespace std;

char dat[100005];

bool zz[100005];

int main()

{

	int n;

	scanf("%d%s",&n,&dat);

	for(int i=0;i<2;i++)

	{

		for(int j=0;j<2;j++)

		{

			zz[0]=i;

			zz[1]=j;

			for(int k=1;k<n-1;k++)

			{

				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');

			}

			if((dat[n-1]=='x')==(zz[n-2]^zz[n-1]^zz[0]) && (dat[0]=='x')==(zz[n-1]^zz[0]^zz[1]))

			{

				for(int k=0;k<n;k++) printf("%c",zz[k]?'W':'S');

				printf("\n");

				return 0;

			}

		}

	}

	printf("-1\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



bool a[100010],r[100010];

int n;



void solve(){

	for(int i=1;i<n;i++){

		if(r[i]==1){

			if(a[i]==0) a[i+1]=a[i-1];

			else a[i+1]=1-a[i-1];

		}

		else{

			if(a[i]==0) a[i+1]=1-a[i-1];

			else a[i+1]=a[i-1];

		}

	}

	int x;

	if(r[0]==1){

		if(a[0]==0) x=a[1];

		else x=1-a[1];

	}

	else{

		if(a[0]==0) x=1-a[1];

		else x=a[1];

	}

	if(a[n]==a[0]&&a[n-1]==x){

		for(int i=0;i<n;i++){

			if(a[i]==0) cout<<"S";

			else cout<<"W";

		}

		exit(0);

	}

}



int main(){

	cin>>n;

	for(int i=0;i<n;i++){

		char x;

		cin>>x;

		if(x=='o') r[i]=1;

		else r[i]=0;

	}

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=1;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=1;

	solve();

	cout<<"-1"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1099354247383384x):
#include<bits/stdc++.h>

using namespace std;



int zz[100005],n;

char dat[100005];



bool check(){

	if(!((dat[0]=='x')==zz[1]^zz[n-1]^zz[0])) return false;

	if(!((dat[n-1]=='x')==zz[n-2]^zz[n-1]^zz[0])) return false;

	return true;

}



int main(){

	scanf("%d%s",&n,dat);

	

	dat[0];

	

	for(int i=0;i<2;i++){

		for(int j=0;j<2;j++){

			zz[1]=i;

			zz[0]=j;

			for(int k=1;k<n-1;k++)

				zz[k+1]=zz[k-1]^zz[k]^(dat[k]=='x');

			if(check()){

				for(int k=0;k<n;k++) printf("%c",zz[k]?'W':'S');

				return 0;

			}

		}

	}

	

	printf("-1\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



bool a[100010],r[100010];

int n;



void solve(){

	for(int i=1;i<n;i++){

		if(r[i]==1){

			if(a[i]==0) a[i+1]=a[i-1];

			else a[i+1]=1-a[i-1];

		}

		else{

			if(a[i]==0) a[i+1]=1-a[i-1];

			else a[i+1]=a[i-1];

		}

	}

	int x;

	if(r[0]==1){

		if(a[0]==0) x=a[1];

		else x=1-a[1];

	}

	else{

		if(a[0]==0) x=1-a[1];

		else x=a[1];

	}

	if(a[n]==a[0]&&a[n-1]==x){

		for(int i=0;i<n;i++){

			if(a[i]==0) cout<<"S";

			else cout<<"W";

		}

		exit(0);

	}

}



int main(){

	cin>>n;

	for(int i=0;i<n;i++){

		char x;

		cin>>x;

		if(x=='o') r[i]=1;

		else r[i]=0;

	}

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=1;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=1;

	solve();

	cout<<"-1"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1097638024952177x):
#include<bits/stdc++.h>

using namespace std;



char p[100005];

int S[100005],P[100005],n; 



int main(){

	scanf("%d%s",&n,&p);

	for(int i=0;i<n;i++){

		if(p[i]=='o') P[i+1]=0;

		else P[i+1]=1;

	}

	P[n+1]=P[1];

	for(int i=0;i<8;i++){

		S[0]=i&1;

		S[1]=(i>>1)&1;

		S[2]=(i>>2)&1;

		for(int j=2;j<=n+1;j++){

			S[j+1]=S[j-2]^P[j];

		}

		if((S[0]^S[1]^S[n]^S[n+1])||(S[1]^S[2]^S[n+1]^S[n+2])) continue;

		for(int j=1;j<=n;j++){

			printf("%c",(S[j-1]^S[j])?'W':'S');

		}

		return 0;

	}

	printf("-1\n");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define MOD 1000000007

#define INF 0x3f3f3f3f

#define INFL 0x3f3f3f3f3f3f3f3f

#define EPS (1e-10)

#define rep(i,n)for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;

typedef pair<int, int>P;

#define prv(i)((i+n-1)%n)

#define nxt(i)((i+1)%n)



int b[100000];

int n; string s;



bool bfs(int a, int m, int c) {

	memset(b, -1, sizeof(b));

	b[prv(0)] = a; b[0] = m; b[nxt(0)] = c;

	queue<int>que; que.push(prv(0)); que.push(nxt(0));

	while (!que.empty()) {

		int p = que.front(); que.pop();

		if (b[p]) {//本当

			if (~b[prv(p)] && !~b[nxt(p)]) {

				if (s[p] == 'o')b[nxt(p)] = b[prv(p)];

				else b[nxt(p)] = !b[prv(p)];

				que.push(nxt(p));

			}

			if (~b[nxt(p)] && !~b[prv(p)]) {

				if (s[p] == 'o')b[prv(p)] = b[nxt(p)];

				else b[prv(p)] = !b[nxt(p)];

				que.push(prv(p));

			}

		}

		else {//うそ

			if (~b[prv(p)] && !~b[nxt(p)]) {

				if (s[p] == 'o')b[nxt(p)] = !b[prv(p)];

				else b[nxt(p)] = b[prv(p)];

				que.push(nxt(p));

			}

			if (~b[nxt(p)] && !~b[prv(p)]) {

				if (s[p] == 'o')b[prv(p)] = !b[nxt(p)];

				else b[prv(p)] = b[nxt(p)];

				que.push(prv(p));

			}

		}

	}

	rep(i, n) {

		if (b[i]) {

			if (!((s[i] == 'o'&&b[prv(i)] == b[nxt(i)]) || (s[i] == 'x'&&b[prv(i)] != b[nxt(i)])))return false;

		}

		else {

			if (!((s[i] == 'o'&&b[prv(i)] != b[nxt(i)]) || (s[i] == 'x'&&b[prv(i)] == b[nxt(i)])))return false;

		}

	}

	return true;

}

signed main() {

	cin >> n >> s;

	rep(i, 2)rep(j, 2)rep(k, 2) {

		if (bfs(i, j, k)) {

			rep(t, n) {

				if (b[t])printf("S");

				else printf("W");

			}

			printf("\n"); return 0;

		}

	}

	puts("-1");

}

// Faster C++ solution for the same problem (measured speedup: 1.4564207037515038x):
#include<bits/stdc++.h>

#define rep(i,n)for(int i=0;i<(n);i++)

using namespace std;

#define nxt(i)((i+1)%n)

#define prv(i)((i+n-1)%n)



int n; string s;

int b[100000];

bool ok(int i, int j) {

	b[0] = i; b[prv(0)] = j;

	for (int i = 0; nxt(i) != prv(0); i = nxt(i)) {

		if ((b[i] && s[i] == 'o') || (!b[i] && s[i] == 'x'))b[nxt(i)] = b[prv(i)];

		else b[nxt(i)] = !b[prv(i)];

	}

	rep(i, n) {

		if (b[i]) {

			if (!((s[i] == 'o'&&b[prv(i)] == b[nxt(i)]) || (s[i] == 'x'&&b[prv(i)] != b[nxt(i)])))return false;

		}

		else {

			if (!((s[i] == 'o'&&b[prv(i)] != b[nxt(i)]) || (s[i] == 'x'&&b[prv(i)] == b[nxt(i)])))return false;

		}

	}

	return true;

}

signed main() {

	cin >> n >> s;

	rep(i, 2)rep(j, 2) {

		if (!ok(i, j))continue;

		rep(k, n) {

			if (b[k])printf("S");

			else printf("W");

		}

		printf("\n");

		return 0;

	}

	puts("-1");

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



bool a[100010],r[100010];

int n;



void solve(){

	for(int i=1;i<n;i++){

		if(r[i]==1){

			if(a[i]==0) a[i+1]=a[i-1];

			else a[i+1]=1-a[i-1];

		}

		else{

			if(a[i]==0) a[i+1]=1-a[i-1];

			else a[i+1]=a[i-1];

		}

	}

	int x;

	if(r[0]==1){

		if(a[0]==0) x=a[1];

		else x=1-a[1];

	}

	else{

		if(a[0]==0) x=1-a[1];

		else x=a[1];

	}

	if(a[n]==a[0]&&a[n-1]==x){

		for(int i=0;i<n;i++){

			if(a[i]==0) cout<<"S";

			else cout<<"W";

		}

		exit(0);

	}

}



int main(){

	cin>>n;

	for(int i=0;i<n;i++){

		char x;

		cin>>x;

		if(x=='o') r[i]=1;

		else r[i]=0;

	}

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=1;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=1;

	solve();

	cout<<"-1"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1096618993612914x):
#include<bits/stdc++.h>

using namespace std;



char s[100005],ans[100005];

int n;



int main(){

	scanf("%d%s",&n,&s);

	char tmp;

	bool f=false;

	for(int i=0;i<4;i++){

		if(i/2==0) ans[0]='S';

		else ans[0]='W';

		if(i%2==0) ans[1]='S';

		else ans[1]='W';

		for(int j=2;j<n;j++){

			tmp=s[j-1];

			if(ans[j-1]=='W') tmp='o'+'x'-tmp;

			if(tmp=='o') ans[j]=ans[j-2];

			else ans[j]='S'+'W'-ans[j-2];

		}

		if(ans[n-2]==ans[0]) tmp='o';

		else tmp='x';

		if(ans[n-1]=='W') tmp='o'+'x'-tmp;

		if(s[n-1]!=tmp) continue;

		if(ans[n-1]==ans[1]) tmp='o';

		else tmp='x';

		if(ans[0]=='W') tmp='o'+'x'-tmp;

		if(s[0]!=tmp) continue;

		f=true;

		break;

	}

	if(!f) printf("-1\n");

	else printf("%s\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



bool a[100010],r[100010];

int n;



void solve(){

	for(int i=1;i<n;i++){

		if(r[i]==1){

			if(a[i]==0) a[i+1]=a[i-1];

			else a[i+1]=1-a[i-1];

		}

		else{

			if(a[i]==0) a[i+1]=1-a[i-1];

			else a[i+1]=a[i-1];

		}

	}

	int x;

	if(r[0]==1){

		if(a[0]==0) x=a[1];

		else x=1-a[1];

	}

	else{

		if(a[0]==0) x=1-a[1];

		else x=a[1];

	}

	if(a[n]==a[0]&&a[n-1]==x){

		for(int i=0;i<n;i++){

			if(a[i]==0) cout<<"S";

			else cout<<"W";

		}

		exit(0);

	}

}



int main(){

	cin>>n;

	for(int i=0;i<n;i++){

		char x;

		cin>>x;

		if(x=='o') r[i]=1;

		else r[i]=0;

	}

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=0;

	a[1]=1;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=0;

	solve();

	memset(a,0,sizeof(a));

	a[0]=1;

	a[1]=1;

	solve();

	cout<<"-1"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.1097216066697724x):
#include<bits/stdc++.h>

using namespace std;



char p[100005];

int S[100005],P[100005],n; 



int main(){

	scanf("%d%s",&n,&p);

	for(int i=0;i<n;i++){

		if(p[i]=='o') P[i+1]=0;

		else P[i+1]=1;

	}

	P[n+1]=P[1];

	for(int i=0;i<8;i++){

		S[0]=i&1;

		S[1]=(i>>1)&1;

		S[2]=(i>>2)&1;

		for(int j=2;j<=n+1;j++){

			S[j+1]=S[j-2]^P[j];

		}

		if((S[0]^S[1]^S[n]^S[n+1])||(S[1]^S[2]^S[n+1]^S[n+2])) continue;

		for(int j=1;j<=n;j++){

			printf("%c",(S[j-1]^S[j])?'W':'S');

		}

		return 0;

	}

	printf("-1\n");

	return 0;

}
// Slower C++ solution:
// C.



#include <iostream>

#include <sstream>

#include <algorithm>

#include <numeric>

#include <vector>

#include <cstdio>

#include <cstdlib>

#include <cstring>



using namespace std;



typedef long long LL;



#ifdef __GNUC__

#define int128_t __int128

#else

typedef LL int128_t;

#endif



int main(int argc, char* argv[]) {

	LL x, k, d;

	cin >> x >> k >> d;

	if (x < 0) x = -x;

	LL r = (x + d - 1) / d;

	if (d >= x && k >= 9) {

		k = 8 + (k % 8);

	}

	int128_t X = x, K = k, D = d, kd = K * D;

	if (kd <= X) {

		x -= k * d;

		k = 0;

	} else if (k >= 100) {

		LL a = x % d;

		LL b = x - a;

		r = b / d;

		if (k >= r) {

			k -= r;

			x -= r * d;

			if (k >= 8) {

				k = 8 + (k % 8);

			}

		}

	}

	vector<LL> q;

	q.push_back(x);

	for (int t = 0; t < k; ++t) {

		vector<LL> nq;

		for (auto a : q) {

			nq.emplace_back(a - d);

			nq.emplace_back(a + d);

		}

		q = nq;

	}

	LL ans = 1LL << 60;

	for (auto a : q) {

		ans = min(ans, abs(a));

	}

	cout << ans << endl;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.21219056637357x):
// C.



#include <iostream>

#include <sstream>

#include <algorithm>

#include <numeric>

#include <vector>

#include <cstdio>

#include <cstdlib>

#include <cstring>



using namespace std;



typedef long long LL;



int main(int argc, char* argv[]) {

	LL x, k, d;

	cin >> x >> k >> d;

	if (x < 0) x = -x;

	LL r = min(k, x / d);

	x -= r * d;

	k -= r;

	LL ans = k % 2 ? abs(x - d) : x;

	cout << ans << endl;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

long long x,k,d;

int main() {

	cin>>x>>k>>d;

	if(x<0) {

		x*=-1;

	}

	if(x/d>k) {

		cout<<x-k*d;

	}

	else {

		long long y;

		while(x>=0) {

			y=x;

			x-=d;

			k--;

		}

		if (k%2==0) {

			cout<<abs(x)<<endl;

		} else {

			cout<<abs(y)<<endl;

		}

	}

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.240640141282191x):
#include <stdio.h>

typedef long long LL;



int main()

{	 

	LL x, k, d, y, z;

	

	scanf("%lld%lld%lld", &x, &k, &d);	

	if(x < 0) x = -x;

	y = x / d;

	if(y >= k) z = x - d * k;

	else{

		z = x % d;

		if((k - y) & 1) z = d - z;

	}

	printf("%lld\n", z);

		

	return 0;

}