Language: C++

#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/


#if 0
int find_par(int x, int par[])
{
	if (par[x] == x)
	{
		return x;
	}
	else
	{
		return par[x] = find_par(par[x], par);
	}
}

bool same(int x, int y, int par[])
{
	if (find_par(x, par) == find_par(y, par))
	{
		return true;
	}

	return false;
}

bool is_para(int index, string s, int a[])
{
	if (s[index] == 'o')
	{
		a[index] = 'S';
		if ()
	}
}

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

	int N;
	string s;

	char a[N];
	int par[N];

	cin >> N >> s;

	for (int i = 0; i < N; i++)
	{
		par[i] = i;
	}
	

	return 0;
}
#endif

/*
bool check(int a[], char hypo1, char hypo2)
{

}
*/

#if 0
int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	int N;

	string s;

	char a[N];

	cin >> N >> s;

	int i = 0;
	for (i = 0; i < 4; i++)
	{
		memset(a, 0, sizeof(a));

		a[0] = i / 2 ? 'W' : 'S';
		a[1] = i % 2 ? 'W' : 'S';
		int j = 2;
		for (; j < N; j++)
		{
			char tmp = 0;

			if (a[j - 1] == 'S')
			{
				if (a[j - 2] == 'S')
				{
					if (s[j-1] == 'o')
					{
						tmp = 'S';
					}
					else
					{
						tmp = 'W';
					}
				}
				else
				{
					if (s[j-1] == 'o')
					{
						tmp = 'W';
					}
					else
					{
						tmp = 'S';
					}
				}
			}
			else if (a[j - 1] == 'W')
			{
				if (a[j - 2] == 'S')
				{
					if (s[j-1] == 'o')
					{
						tmp = 'W';
					}
					else
					{
						tmp = 'S';
					}
				}
				else
				{
					if (s[j-1] == 'o')
					{
						tmp = 'S';
					}
					else
					{
						tmp = 'W';
					}
				}
			}
			if (a[j] == 0)
			{
				a[j] = tmp;
			}
			else
			{
				if (a[j] != tmp)
				{
					break;
				}
			}
		}
		if (j == N)
		{
			if (a[N-1] == 'S')
			{
				if (a[N-2] == 'S')
				{
					if (s[N-1] == 'o')
					{
						if (a[0] == 'S')
						{
							break;
						}
					}
					else
					{
						if (a[0] == 'W')
						{
							break;
						}
					}
				}
				else
				{
					if (s[N-1] == 'o')
					{
						if (a[0] == 'W')
						{
							break;
						}
					}
					else
					{
						if (a[0] == 'S')
						{
							break;
						}
					}
				}
			}
			else
			{
				if (a[N-2] == 'S')
				{
					if (s[N-1] == 'o')
					{
						if (a[0] == 'W')
						{
							break;
						}
					}
					else
					{
						if (a[0] == 'S')
						{
							break;
						}
					}
				}
				else
				{
					if (s[N-1] == 'o')
					{
						if (a[0] == 'S')
						{
							break;
						}
					}
					else
					{
						if (a[0] == 'W')
						{
							break;
						}
					}
				}
			}
		}
	}

	if (i < 4)
	{
		rep(i, N)
		{
			cout << a[i];
		}
		cout << endl;
	}
	else
	{
		cout << -1 << endl;
	}


	return 0;
}
#endif

int main(){
    ios_base::sync_with_stdio(false); //Fast I/O
    cin.tie(0);
    cout.tie(0);
 
 	int n;
 	char s[100005];
 	bool A[100005];
 	cin >> n >> s;
 	s[n]=s[0];
 	s[n+1]=s[1];
 
 	FOR(i,0,4){
 		A[0]=i&1;
 		A[1]=(i>>1)&1;
 		for(int i=2;i<n+2;i++){

 			// sheep and x || wolf and o
			if(A[i-1]^(s[i-1]=='o'))
				A[i]=A[i-2]^1;
			else 
				A[i]=A[i-2];
		}
 		if(A[n]==A[0] && A[n+1]==A[1]){
 			FOR(i,0,n){
 				if(A[i])
 					cout << 'S';
 				else
 					cout << "W";
 			}
 			return 0;
 		}
 	}
 
 	cout << -1 << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:288:13: error: 'i' was not declared in this scope
  288 |         FOR(i,0,4){
      |             ^
a.cc:288:9: error: 'FOR' was not declared in this scope
  288 |         FOR(i,0,4){
      |         ^~~