Language: C++

#include<bits/stdc++.h>
using namespace std;
int n;
string s;
vector<char> a,b,c,d;
int main(){
  cin>>n>>s;
  a.push_back('S');
  a.push_back('S');
  b.push_back('S');
  b.push_back('W');
  c.push_back('W');
  c.push_back('S');
  d.push_back('W');
  d.push_back('W');
  for(int i=1;i<n;i++){
    if(a[i]=='S'){
      if(s[i]=='o'){
        if(a[i-1]=='S'){
          a.push_back('S');
        }else{
          a.push_back('W');
        }
      }else{
        if(a[i-1]=='S'){
          a.push_back('W');
        }else{
          a.push_back('S');
        }
      }
    }else{
      if(s[i]=='o'){
        if(a[i-1]=='S'){
          a.push_back('W');
        }else{
          a.push_back('S');
        }
      }else{
        if(a[i-1]=='S'){
          a.push_back('S');
        }else{
          a.push_back('W');
        }
      }
    }
    if(b[i]=='S'){
      if(s[i]=='o'){
        if(b[i-1]=='S'){
          b.push_back('S');
        }else{
          b.push_back('W');
        }
      }else{
        if(b[i-1]=='S'){
          b.push_back('W');
        }else{
          b.push_back('S');
        }
      }
    }else{
      if(s[i]=='o'){
        if(b[i-1]=='S'){
          b.push_back('W');
        }else{
          b.push_back('S');
        }
      }else{
        if(b[i-1]=='S'){
          b.push_back('S');
        }else{
          b.push_back('W');
        }
      }
    }
    if(c[i]=='S'){
      if(s[i]=='o'){
        if(c[i-1]=='S'){
          c.push_back('S');
        }else{
          c.push_back('W');
        }
      }else{
        if(c[i-1]=='S'){
          c.push_back('W');
        }else{
          c.push_back('S');
        }
      }
    }else{
      if(s[i]=='o'){
        if(c[i-1]=='S'){
          c.push_back('W');
        }else{
          c.push_back('S');
        }
      }else{
        if(c[i-1]=='S'){
          c.push_back('S');
        }else{
          c.push_back('W');
        }
      }
    }
    if(d[i]=='S'){
      if(s[i]=='o'){
        if(d[i-1]=='S'){
          d.push_back('S');
        }else{
          d.push_back('W');
        }
      }else{
        if(d[i-1]=='S'){
          d.push_back('W');
        }else{
          d.push_back('S');
        }
      }
    }else{
      if(s[i]=='o'){
        if(d[i-1]=='S'){
          d.push_back('W');
        }else{
          d.push_back('S');
        }
      }else{
        if(d[i-1]=='S'){
          d.push_back('S');
        }else{
          d.push_back('W');
        }
      }
    }
  }
  if(a.front()==a.back()){
    if(s[0]=='o'&&a[1]==a[n-1]||s[0]=='x'&&a[1]!=a[n-1]){
    for(int i=0;i<n;i++){
      cout<<a[i];
    }
    return 0;
  }
  if(b.front()==b.back()){
    if(s[0]=='o'&&b[1]==b[n-1]||s[0]=='x'&&b[1]!=b[n-1]){
    for(int i=0;i<n;i++){
      cout<<b[i];
    }
    return 0;
  }
  if(c.front()==c.back()){
    if(s[0]=='o'&&c[1]==c[n-1]||s[0]=='x'&&c[1]!=c[n-1]){
    for(int i=0;i<n;i++){
      cout<<c[i];
    }
    return 0;
  }
  if(d.front()==d.back()){
    if(s[0]=='o'&&d[1]==d[n-1]||s[0]=='x'&&d[1]!=d[n-1]){
    for(int i=0;i<n;i++){
      cout<<d[i];
    }
    return 0;
  }
  cout<<-1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:163:2: error: expected '}' at end of input
  163 | }
      |  ^
a.cc:148:26: note: to match this '{'
  148 |   if(c.front()==c.back()){
      |                          ^
a.cc:163:2: error: expected '}' at end of input
  163 | }
      |  ^
a.cc:141:26: note: to match this '{'
  141 |   if(b.front()==b.back()){
      |                          ^
a.cc:163:2: error: expected '}' at end of input
  163 | }
      |  ^
a.cc:134:26: note: to match this '{'
  134 |   if(a.front()==a.back()){
      |                          ^
a.cc:163:2: error: expected '}' at end of input
  163 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^