stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int pi=3.1415926535897932384626433832795;

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

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

#define ll long long

#define inf int(1e9+7)

#define pb push_back

#define mp make_pair

char ch[100005];

char ans[100005];

char tmp;

bool flag;

int n;

int main()

{

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

    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=ch[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(tmp!=ch[n-1])

            continue;

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

            tmp='o';

        else

            tmp='x';

        if(ans[0]=='W')

            tmp='o'+'x'-tmp;

        if(tmp!=ch[0])

            continue;

        flag=1;

        break;

    }

    puts((!flag?"-1":ans));

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

char s[100001];

char t[100001];

int a[100000];

int main()

{

	int n,i,j,k;

	scanf("%d",&n);

	scanf("%s",s);

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

	{

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

		{

			if(i==0)

			{

				a[0]=0;

			}

			else

			{

				a[0]=1;

			}

			if(j==0)

			{

				a[1]=0;

			}

			else

			{

				a[1]=1;

			}

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

			{

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

				{

					if(a[k-1]==0)

					{

						a[k]=a[k-2];

					}

					else

					{

						a[k]=1-a[k-2];

					}

				}

				else

				{

					if(a[k-1]==0)

					{

						a[k]=1-a[k-2];

					}

					else

					{

						a[k]=a[k-2];

					}

				}

			}

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

			{

				if(a[n-1]==0)

				{

					if(a[n-2]!=a[0])

						continue;

				}

				else

				{

					if(a[n-2]==a[0])

						continue;

				}

			}

			else

			{

				if(a[n-1]==0)

				{

					if(a[n-2]==a[0])

						continue;

				}

				else

				{

					if(a[n-2]!=a[0])

						continue;

				}

			}

			if(s[0]=='o')

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			else

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			for(k=0;k<n;k++)

			{

				if(a[k]==0)

				{

					t[k]='S';

				}

				else

				{

					t[k]='W';

				}

			}

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

			return 0;

		}

	}

	puts("-1");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int pi=3.1415926535897932384626433832795;

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

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

#define ll long long

#define inf int(1e9+7)

#define pb push_back

#define mp make_pair

int n;

string s;

bool res[100005];

int main()

{

	cin>>n>>s;

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

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

		{

			res[0]=a;

			res[1]=b;

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

				res[j]=((s[j-1]!='o')^res[j-1])^res[j-2];

			bool flag=1;

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

			{

				int pr=(x-1+n)%n;

				int nx=(x+1+n)%n;

				if(((s[x]=='o')^res[x])!=(res[pr]==res[nx]))

					flag=0;

			}

			if(flag)

			{

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

					cout<<(!res[j]?'S':'W');

				return 0;

			}

		}

	puts("-1");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

char s[100001];

char t[100001];

int a[100000];

int main()

{

	int n,i,j,k;

	scanf("%d",&n);

	scanf("%s",s);

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

	{

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

		{

			if(i==0)

			{

				a[0]=0;

			}

			else

			{

				a[0]=1;

			}

			if(j==0)

			{

				a[1]=0;

			}

			else

			{

				a[1]=1;

			}

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

			{

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

				{

					if(a[k-1]==0)

					{

						a[k]=a[k-2];

					}

					else

					{

						a[k]=1-a[k-2];

					}

				}

				else

				{

					if(a[k-1]==0)

					{

						a[k]=1-a[k-2];

					}

					else

					{

						a[k]=a[k-2];

					}

				}

			}

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

			{

				if(a[n-1]==0)

				{

					if(a[n-2]!=a[0])

						continue;

				}

				else

				{

					if(a[n-2]==a[0])

						continue;

				}

			}

			else

			{

				if(a[n-1]==0)

				{

					if(a[n-2]==a[0])

						continue;

				}

				else

				{

					if(a[n-2]!=a[0])

						continue;

				}

			}

			if(s[0]=='o')

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			else

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			for(k=0;k<n;k++)

			{

				if(a[k]==0)

				{

					t[k]='S';

				}

				else

				{

					t[k]='W';

				}

			}

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

			return 0;

		}

	}

	puts("-1");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

const int pi=3.1415926535897932384626433832795;

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

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

#define ll long long

#define inf int(1e9+7)

#define pb push_back

#define mp make_pair

void solve(int n,string s,int t1,int t2)

{

	vector<int>sh(n);

	sh[0]=t1;

	sh[1]=t2;

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

		sh[i]=(sh[i-1]+sh[i-2]+(s[i-1]=='x'))%2;

	if((sh[n-1]+sh[0]+sh[1]+(s[0]=='x'))%2==0&&(sh[n-2]+sh[n-1]+sh[0]+(s[n-1]=='x'))%2==0)

	{

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

			cout<<(sh[i]?'W':'S');

		exit(0);

	}		

}

int main()

{

	int n;

	string s;

	cin>>n>>s;

	solve(n,s,0,0);

	solve(n,s,0,1);

	solve(n,s,1,0);

	solve(n,s,1,1);

	puts("-1");

}

// Optimized solution to the same problem (faster):
#include<cstdio>

using namespace std;

char s[100001];

char t[100001];

int a[100000];

int main()

{

	int n,i,j,k;

	scanf("%d",&n);

	scanf("%s",s);

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

	{

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

		{

			if(i==0)

			{

				a[0]=0;

			}

			else

			{

				a[0]=1;

			}

			if(j==0)

			{

				a[1]=0;

			}

			else

			{

				a[1]=1;

			}

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

			{

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

				{

					if(a[k-1]==0)

					{

						a[k]=a[k-2];

					}

					else

					{

						a[k]=1-a[k-2];

					}

				}

				else

				{

					if(a[k-1]==0)

					{

						a[k]=1-a[k-2];

					}

					else

					{

						a[k]=a[k-2];

					}

				}

			}

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

			{

				if(a[n-1]==0)

				{

					if(a[n-2]!=a[0])

						continue;

				}

				else

				{

					if(a[n-2]==a[0])

						continue;

				}

			}

			else

			{

				if(a[n-1]==0)

				{

					if(a[n-2]==a[0])

						continue;

				}

				else

				{

					if(a[n-2]!=a[0])

						continue;

				}

			}

			if(s[0]=='o')

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			else

			{

				if(a[0]==0)

				{

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

						continue;

				}

				else

				{

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

						continue;

				}

			}

			for(k=0;k<n;k++)

			{

				if(a[k]==0)

				{

					t[k]='S';

				}

				else

				{

					t[k]='W';

				}

			}

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

			return 0;

		}

	}

	puts("-1");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstring>

#include<cstdio>

#include<iostream>

using namespace std;

char s[100010];

int r[100010];

bool flag;

int main()

{

	int n;

	while(scanf("%d",&n)==1)

	{

		scanf("%s",s);

		int num=0;

		while(num<4)

		{

			flag=true;

			if(num==0)

			{

				r[0]=1;

			    r[1]=1;

			}

			if(num==1)

			{

				r[0]=1;

			    r[1]=0;

			}

			if(num==2)

			{

				r[0]=0;

			    r[1]=1;

			}

			if(num==3)

			{

				r[0]=0;

			    r[1]=0;

			}

			//printf("%d %d\n",r[0],r[1]);

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

			{

				if(i==0)

				{

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

					{

						if(r[i]==1)

						r[n-1]=r[i+1];

						if(r[i]==0)

						r[n-1]=1-r[i+1];

					}

					if(s[i]=='x')

					{

						if(r[i]==1)

						r[n-1]=1-r[i+1];

						if(r[i]==0)

						r[n-1]=r[i+1];

					}

				}

				

				if(i==n-1)

				{

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

					{

						if(r[i]==1)

						if(r[i-1]!=r[0])

						flag=false;

						if(r[i]==0)

						if(r[i-1]==r[0])

						flag=false;

					}

					if(s[i]=='x')

					{

						if(r[i]==1)

						if(r[i-1]==r[0])

						flag=false;

						if(r[i]==0)

						if(r[i-1]!=r[0])

						flag=false;

					}

				}

				

				if(i>0&&i<n-2)

				{

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

					{

						if(r[i]==1)

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

						if(r[i]==0)

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

					}

					if(s[i]=='x')

					{

						if(r[i]==1)

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

						if(r[i]==0)

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

					}

				}

				

				if(i==n-2)

				{

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

					{

						if(r[i]==1)

						if(r[i-1]!=r[i+1])

						flag=false;

						if(r[i]==0)

						if(r[i-1]==r[i+1])

						flag=false;

					}

					if(s[i]=='x')

					{

						if(r[i]==1)

						if(r[i-1]==r[i+1])

						flag=false;

						if(r[i]==0)

						if(r[i-1]!=r[i+1])

						flag=false;

					}

				}

			}

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

			printf("%d",r[i]);

			cout<<endl;*/

			if(flag)

			break;

			num++;

		}

		if(flag)

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

		{

			if(r[i]==1)

			printf("S");

			else printf("W");

		}

		else printf("-1");

		printf("\n");

	}

	return 0;

} 

// Optimized solution to the same problem (faster):
#include <cstdio>

int n;

char s[100001], r[100001];

bool c ( char a, char b )

{

	r[0] = a;

	r[1] = b;

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

		r[i] = r[i - 1] == 'S' ? s[i - 1] == 'o' ? r[i - 2] : r[i - 2] == 'S' ? 'W' : 'S' : s[i - 1] == 'x' ? r[i - 2] : r[i - 2] == 'S' ? 'W' : 'S';

	return ! ( r[n - 1] == 'S' && ( ( s[n - 1] == 'o' && r[n - 2] != r[0] ) || ( s[n - 1] == 'x' && r[n - 2] == r[0] ) ) ) &&

	       ! ( r[0] == 'S' && ( ( s[0] == 'o' && r[1] != r[n - 1] ) || ( s[0] == 'x' && r[1] == r[n - 1] ) ) ) &&

	       ! ( r[n - 1] == 'W' && ( ( s[n - 1] == 'x' && r[n - 2] != r[0] ) || ( s[n - 1] == 'o' && r[n - 2] == r[0] ) ) ) &&

	       ! ( r[0] == 'W' && ( ( s[0] == 'x' && r[1] != r[n - 1] ) || ( s[0] == 'o' && r[1] == r[n - 1] ) ) );

}

int main()

{

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

	puts ( c ( 'S', 'W' ) || c ( 'W', 'S' ) || c ( 'W', 'W' ) || c ( 'S', 'S' ) ? r : "-1" );

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<queue>

#include<algorithm>

#include<cmath>

#include<iostream>

using namespace std;

char a[100005];

int s[100005];

int N[4][2]= {{0,0},{0,1},{1,1},{1,0}};

int main()

{

    int n;

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

    {

        scanf(" %s",a);

        int f=0;

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

        {

            s[0]=N[k][0],s[1]=N[k][1];

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

            {

                if(!s[i])

                {

                    if(a[(n+i)%n]=='o')

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

                    else

                        s[i+1]=s[i-1]^1;

                }

                else

                {

                    if(a[(n+i)%n]=='o')

                        s[i+1]=s[i-1]^1;

                    else

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

                }

            }

            if(s[0]==s[n]&&s[1]==s[n+1])

            {

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

                    if(!s[i])

                        putchar('S');

                    else

                        putchar('W');

                printf("\n");

                f=1;

                break;

            }

        }

            if(!f)puts("-1");

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>

using namespace std;



int main()

{

    char s[4][2]={'S','S','S','W','W','S','W','W'},a[100005],b[100005];

    int n,i,k,flag;

    scanf("%d",&n);

    scanf("%s",a);

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

    {   flag=0;

        b[0]=s[k][0],b[1]=s[k][1];

        char temp;

        if(a[0]=='o'&&b[0]=='S')temp=b[1];

        else if(a[0]=='x'&&b[0]=='S')

        {

            if(b[1]=='S')temp='W';

            else temp='S';

        }

        else if(a[0]=='x'&&b[0]=='W')temp=b[1];

        else if(a[0]=='o'&&b[0]=='W')

        {

         if(b[1]=='W')temp='S';

         else temp='W';

        }

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

        {

          if(a[i]=='o'&&b[i]=='S')b[i+1]=b[i-1];

        else if(a[i]=='x'&&b[i]=='S')

        {

            if(b[i-1]=='S')b[i+1]='W';

            else b[i+1]='S';

        }

        else if(a[i]=='x'&&b[i]=='W')b[i+1]=b[i-1];

        else if(a[i]=='o'&&b[i]=='W')

        {

         if(b[i-1]=='W')b[i+1]='S';

         else b[i+1]='W';

        }

        }

        if(b[n]==b[0]&&temp==b[n-1])

        {

            flag=1;

            break;

        }

    }

    b[n]='\0';

    if(flag)printf("%s\n",b);

    else printf("-1\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <algorithm>

#include <iostream>

#include <cstring>

#include <cstdlib>

#include <cstdio>

#include <cmath>

using namespace std;

char s[101000];

int f;

void F(int x1, int x2)   // 0ÀÇ 1 Ñò  ÀÇ¼Ù ÑòÕæ

{

	char S[101000];

	int len = strlen(s);

	S[0] = x1==1?'S':'W';

	S[1] = x2==1?'S':'W';

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

	{

		int k = i;

		if (k==len+1)

			k = 1;

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

		{

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

			{

				if (S[i-2]=='S')

					S[i]='S';

				else

					S[i]='W';

			}

			if (s[k-1]=='x')

			{

				if (S[i-2]=='S')

					S[i]='W';

				else

					S[i]='S';

			}

		}

		if (S[k-1]=='W')

		{

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

			{

				if (S[i-2]=='S')

					S[i] = 'W';

				else

					S[i] = 'S';

			}

			if (s[k-1]=='x')

			{

				if (S[i-2]=='S')

					S[i] = 'S';

				else

					S[i] = 'W';

			}

		}

	}

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

	{

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

			printf("%c", S[i]);

		printf("\n");

		f=1;

	}

	return;

}

int main(void)

{

	int n;

	scanf("%d", &n);

	scanf(" %s", s);

	f=0;

	for (int i = 1; i >= 0; i--)

	{

		for (int j = 1; j >= 0; j--)

		{

			F(i,j);

			if (f==1)

				break;

		}

		if (f==1)

			break;

	}

	if (f==0)

		printf("-1\n");

	return 0;

}

// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>

using namespace std;



int main()

{

    char s[4][2]={'S','S','S','W','W','S','W','W'},a[100005],b[100005];

    int n,i,k,flag;

    scanf("%d",&n);

    scanf("%s",a);

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

    {   flag=0;

        b[0]=s[k][0],b[1]=s[k][1];

        char temp;

        if(a[0]=='o'&&b[0]=='S')temp=b[1];

        else if(a[0]=='x'&&b[0]=='S')

        {

            if(b[1]=='S')temp='W';

            else temp='S';

        }

        else if(a[0]=='x'&&b[0]=='W')temp=b[1];

        else if(a[0]=='o'&&b[0]=='W')

        {

         if(b[1]=='W')temp='S';

         else temp='W';

        }

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

        {

          if(a[i]=='o'&&b[i]=='S')b[i+1]=b[i-1];

        else if(a[i]=='x'&&b[i]=='S')

        {

            if(b[i-1]=='S')b[i+1]='W';

            else b[i+1]='S';

        }

        else if(a[i]=='x'&&b[i]=='W')b[i+1]=b[i-1];

        else if(a[i]=='o'&&b[i]=='W')

        {

         if(b[i-1]=='W')b[i+1]='S';

         else b[i+1]='W';

        }

        }

        if(b[n]==b[0]&&temp==b[n-1])

        {

            flag=1;

            break;

        }

    }

    b[n]='\0';

    if(flag)printf("%s\n",b);

    else printf("-1\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <algorithm>

#include <cstring>

#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <queue>

#include <string>

using namespace std;

int a[100010];

char s[100010];

int n, dir[4][2] = {{0, 0}, {1, 1}, {0, 1}, {1, 0}};

int main ()

{

    scanf("%d", &n);

    scanf("%s", s);

    int f = 0;

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

    {

        a[0] = dir[i][0];

        a[1] = dir[i][1];

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

        {

            if(!a[j])

            {

                if(s[j%n] == 'o')

                    a[j+1] = a[j-1];

                else

                    a[j+1] = !a[j-1];

            }

            if(a[j])

            {

                if(s[j%n] == 'o')

                    a[j+1] = !a[j-1];

                else

                    a[j+1] = a[j-1];

            }

        }

        if(a[n] == a[0] && a[n+1] == a[1])

        {

            f = 1;

            break;

        }

    }

    if(f)

    {

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

            if(a[i]) printf("W");

            else  printf("S");

        printf("\n");

    }

    else printf("-1\n");

}


// Optimized solution to the same problem (faster):
#include <stdio.h>

#include <algorithm>

using namespace std;



int main()

{

    char s[4][2]={'S','S','S','W','W','S','W','W'},a[100005],b[100005];

    int n,i,k,flag;

    scanf("%d",&n);

    scanf("%s",a);

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

    {   flag=0;

        b[0]=s[k][0],b[1]=s[k][1];

        char temp;

        if(a[0]=='o'&&b[0]=='S')temp=b[1];

        else if(a[0]=='x'&&b[0]=='S')

        {

            if(b[1]=='S')temp='W';

            else temp='S';

        }

        else if(a[0]=='x'&&b[0]=='W')temp=b[1];

        else if(a[0]=='o'&&b[0]=='W')

        {

         if(b[1]=='W')temp='S';

         else temp='W';

        }

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

        {

          if(a[i]=='o'&&b[i]=='S')b[i+1]=b[i-1];

        else if(a[i]=='x'&&b[i]=='S')

        {

            if(b[i-1]=='S')b[i+1]='W';

            else b[i+1]='S';

        }

        else if(a[i]=='x'&&b[i]=='W')b[i+1]=b[i-1];

        else if(a[i]=='o'&&b[i]=='W')

        {

         if(b[i-1]=='W')b[i+1]='S';

         else b[i+1]='W';

        }

        }

        if(b[n]==b[0]&&temp==b[n-1])

        {

            flag=1;

            break;

        }

    }

    b[n]='\0';

    if(flag)printf("%s\n",b);

    else printf("-1\n");

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
//Menagerie

#include<iostream>

#include<iomanip>

#include<algorithm>

#include<cstring>

#include<string>

#include<cmath>

#include<vector>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

using namespace std;

const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右

const int N=100005,M=1000005,mod=1000000007;

const long long llinf=9223372036854775807ll;

// 1 相同 0 不同 

// 1 羊 0 狼 

// 1 相同 0 不同 

int n;

bool talk[N],ani[N];

void make(void)

{

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

	{

		bool op=1^(ani[i]^talk[i]);

		if(op==true)

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

		else

			ani[i+1]=ani[i-1]^1;

	}

}

bool check(void)

{

	int op1=1^(ani[1]^talk[1]),op2=1^(ani[n]^talk[n]);

	if(op1!=(1^(ani[n]^ani[2])))

		return false;

	if(op2!=(1^(ani[1]^ani[n-1])))

		return false;

	return true;

}

void print(void)

{

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

		cout<<((ani[i]==1)?'S':'W');

}

int main(){

	cin>>n;

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

	{

		char ch;

		cin>>ch;

		if(ch=='o')

			talk[i]=true;

		else

			talk[i]=false;

	}

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

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

		{

			ani[1]=i,ani[2]=j;

			make();

			if(check())

			{

				print();

				return 0;

			}

		}

	cout<<-1;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

			if(a[i] == 'o') {

				if(a[i] == 'o') ans[i + 1] = (ans[i - 1] == 1?2:1);

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

	scanf("%s",a + 1);

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main(){

	string s,c,beg[4]={"SS","SW","WS","WW"};

	int i,j,n;

	cin>>n;

	cin>>s;

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

	{

		c=beg[j];

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

		{

			if(c[i]=='S')

			{

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

					c+=c[i-1];

				else

				{

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

						c+="W";

					else

						c+="S";

				}

			}

			else

			{

				if(s[i]=='x')

					c+=c[i-1];

				else

				{

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

						c+="W";

					else

						c+="S";

				}

			}

		}

		if(c[0]=='S')

		{

			if(s[0]=='o')

			{

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

					continue;

			}

			else

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

					continue;

		} 

		else

		{

			if(s[0]=='x')

			{

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

					continue;

			}

			else

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

					continue;

		}

		if(c[n-1]=='S')

		{

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

			{

				if(c[0]!=c[n-2])

					continue;

			}

			else

				if(c[0]==c[n-2])

					continue;

		} 

		else

		{

			if(s[n-1]=='x')

			{

				if(c[0]!=c[n-2])

					continue;

			}

			else

				if(c[0]==c[n-2])

					continue;

		}

		cout<<c<<endl;

		return 0;

	}

	cout<<"-1"<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int ans[100005],n;

char a[100005];

int check() {

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

		int l = i - 1,r = i + 1;

		if(l == 0) l = n; 

		if(r == n + 1) r = 1;

		if(ans[i] == 1) {

			if(a[i] == 'o' && ans[l] != ans[r]) return 0;

			if(a[i] == 'x' && ans[l] == ans[r]) return 0;

		}

		else {

			if(a[i] == 'o' && ans[l] == ans[r]) return 0;

			if(a[i] == 'x' && ans[l] != ans[r]) return 0;

		}

	}

	return 1;

}

void init() {

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

		if(ans[i] == 1) {

			if(a[i] == 'o') ans[i + 1] = ans[i - 1];

			if(a[i] == 'x') {

				if(a[i] == 'o') ans[i + 1] = ans[i - 1];

				else ans[i + 1] = (ans[i - 1] == 1?2:1);

			}

		}

		if(ans[i] == 2) {

			if(a[i] == 'x') ans[i + 1] = ans[i - 1];

			if(a[i] == 'o') {

				if(a[i] == 'o') ans[i + 1] = (ans[i - 1] == 1?2:1);

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

			}

		}

	}

}



void print() {

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

		if(ans[i] == 1) printf("S");

		else printf("W");

	}

}

int main() {

	scanf("%d",&n);

	scanf("%s",a + 1);

	ans[1] = ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 1,ans[2] = 2;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	ans[1] = 2,ans[2] = 1;

	init();

	if(check()) {

		print();

		printf("\n");

		return 0;

	}

	printf("-1\n");

	return 0;

} 

// Fastest known solution for this problem: