Language: C++

#include<iostream>
#include<string>
#include<complex>
#include<vector>
#include<algorithm>
#include<functional>
#include<array>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	bool ans = false;

	vector<char> v;
	v[1] = 'S'; v[2] = 'S';
	for (int i = 2;i < n;i++) {
		if (v[i] == 'S'&&s[i - 1] == 'o') v[i + 1] = v[i - 1];
		if (v[i] == 'W'&&s[i - 1] == 'x') v[i + 1] = v[i - 1];
		if (v[i] == 'S'&&s[i - 1] == 'x') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
		if (v[i] == 'W'&&s[i - 1] == 'o') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
	}
	if (v[n] == 'S'&&s[n - 1] == 'o') if (v[n - 1] == v[1]) ans = true;
	if (v[n] == 'S'&&s[n - 1] == 'x') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'o') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'x') if (v[n - 1] == v[1]) ans = true;
	if (ans == true) { for (int i = 1;i <= n;i++) cout << v[i];cout << endl; return 0; }
	
	vector<char> v;
	v[1] = 'W'; v[2] = 'S';
	for (int i = 2;i < n;i++) {
		if (v[i] == 'S'&&s[i - 1] == 'o') v[i + 1] = v[i - 1];
		if (v[i] == 'W'&&s[i - 1] == 'x') v[i + 1] = v[i - 1];
		if (v[i] == 'S'&&s[i - 1] == 'x') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
		if (v[i] == 'W'&&s[i - 1] == 'o') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
	}
	if (v[n] == 'S'&&s[n - 1] == 'o') if (v[n - 1] == v[1]) ans = true;
	if (v[n] == 'S'&&s[n - 1] == 'x') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'o') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'x') if (v[n - 1] == v[1]) ans = true;
	if (ans == true) { for (int i = 1;i <= n;i++) cout << v[i]; cout << endl;return 0; }

	vector<char> v;
	v[1] = 'S'; v[2] = 'W';
	for (int i = 2;i < n;i++) {
		if (v[i] == 'S'&&s[i - 1] == 'o') v[i + 1] = v[i - 1];
		if (v[i] == 'W'&&s[i - 1] == 'x') v[i + 1] = v[i - 1];
		if (v[i] == 'S'&&s[i - 1] == 'x') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
		if (v[i] == 'W'&&s[i - 1] == 'o') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
	}
	if (v[n] == 'S'&&s[n - 1] == 'o') if (v[n - 1] == v[1]) ans = true;
	if (v[n] == 'S'&&s[n - 1] == 'x') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'o') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'x') if (v[n - 1] == v[1]) ans = true;
	if (ans == true) { for (int i = 1;i <= n;i++) cout << v[i]; cout << endl;return 0; }

	vector<char> v;
	v[1] = 'W'; v[2] = 'W';
	for (int i = 2;i < n;i++) {
		if (v[i] == 'S'&&s[i - 1] == 'o') v[i + 1] = v[i - 1];
		if (v[i] == 'W'&&s[i - 1] == 'x') v[i + 1] = v[i - 1];
		if (v[i] == 'S'&&s[i - 1] == 'x') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
		if (v[i] == 'W'&&s[i - 1] == 'o') if (v[i - 1] == 'S') v[i + 1] = 'W';else v[i + 1] = 'S';
	}
	if (v[n] == 'S'&&s[n - 1] == 'o') if (v[n - 1] == v[1]) ans = true;
	if (v[n] == 'S'&&s[n - 1] == 'x') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'o') if (v[n - 1] != v[1]) ans = true;
	if (v[n] == 'W'&&s[n - 1] == 'x') if (v[n - 1] == v[1]) ans = true;
	if (ans == true) { for (int i = 1;i <= n;i++) cout << v[i]; cout << endl;return 0; }

	cout << -1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:22: error: redeclaration of 'std::vector<char> v'
   35 |         vector<char> v;
      |                      ^
a.cc:21:22: note: 'std::vector<char> v' previously declared here
   21 |         vector<char> v;
      |                      ^
a.cc:49:22: error: redeclaration of 'std::vector<char> v'
   49 |         vector<char> v;
      |                      ^
a.cc:21:22: note: 'std::vector<char> v' previously declared here
   21 |         vector<char> v;
      |                      ^
a.cc:63:22: error: redeclaration of 'std::vector<char> v'
   63 |         vector<char> v;
      |                      ^
a.cc:21:22: note: 'std::vector<char> v' previously declared here
   21 |         vector<char> v;
      |                      ^