Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

n = int(input())
s = input()
t1 = ["S","S"]
l1 = ["W","W"]
t2 = ["S","W"]
l2 = ["W","S"]
for i in range(n-2):
    t1.append("S")
for i in range(n):
    if i+1 <= n-1 and i != 0:
        if (s[i] == "x" and t1[i] == "S") or (s[i] == "o" and t1[i] == "W"):
            if t1[i-1] == "S":
                t1[i+1] = "W"

            else:
                t1[i+1] = "S"

        else:
            t1[i+1] = t1[i]
    elif i == 0:
        pass
    else:
        if ((s[i] == "x" and t1[i] == "S") or (s[i] == "o" and t1[i] == "W")) and t1[0] == t1[i-1]: t1 = "-1"
        elif ((s[i] == "x" and t1[i] == "W") or (s[i] == "o" and t1[i] == "S")) and t1[0] != t1[i-1]: t1 = "-1"
for i in range(n-2):
    t2.append("S")

for i in range(n):
    if i+1 <= n-1 and i != 0:
        if (s[i] == "x" and t2[i] == "S") or (s[i] == "o" and t2[i] == "W"):
            if t2[i-1] == "S":
                t2[i+1] = "W"

            else:
                t2[i+1] = "S"

        else:
            t2[i+1] = t2[i]
    elif i == 0:
        pass
    else:
        if ((s[i] == "x" and t2[i] == "S") or (s[i] == "o" and t2[i] == "W")) and t2[0] == t2[i-1]: t = "-1"
        elif ((s[i] == "x" and t2[i] == "W") or (s[i] == "o" and t2[i] == "S")) and t2[0] != t2[i-1]: t = "-1"

for i in range(n-2):
    l1.append("W")

for i in range(n):
    if i+1 <= n-1 and i != 0:
        if (s[i] == "x" and l1[i] == "S") or (s[i] == "o" and l1[i] == "W"):
            if l1[i-1] == "S":
                l1[i+1] = "W"

            else:
                l1[i+1] = "S"

        else:
            l1[i+1] = l1[i]
            
    elif i == 0:
        pass
    else:
        if(s[i] == "x" and l1[i] == "S") or (s[i] == "o" and l1[i] == "W") and l1[0] == l1[i-1]: l1 = "-1"
        elif (s[i] == "x" and l1[i] == "W") or (s[i] == "o" and l1[i] == "S") and l[0] != l1[i-1]: l1 = "-1"
for i in range(n-2):
    l2.append("S")

for i in range(n):
    if i+1 <= n-1 and i != 0:
        if (s[i] == "x" and l2[i] == "S") or (s[i] == "o" and l2[i] == "W"):
            if l2[i-1] == "S":
                l2[i+1] = "W"

            else:
                l2[i+1] = "S"

        else:
            l2[i+1] = l2[i]
            
    elif i == 0:
        pass
    else:
        if(s[i] == "x" and l2[i] == "S") or (s[i] == "o" and l2[i] == "W") and l2[0] == l2[i-1]: l2 = "-1"
        elif (s[i] == "x" and l2[i] == "W") or (s[i] == "o" and l2[i] == "S") and l2[0] != l2[i-1]: l2 = "-1"
if t1 != "-1":
    for i in t1:
        print(i,end="")
elif t2 != "-1":
    for i in t2:
        print(i,end="")
elif l1 != "-1":
    for i in l1:
        print(i,end="")
elif l2 != "-1":
    for i in l2:
        print(i,end="")
else:print("-1")

Fixed submission:
n = int(input())
s = input()

def addleave(p):
    for i in range(1,n):
        if s[i]=="o":
            if p[i]=="S":
                p += "S" if p[i-1]=="S" else "W"
            else:
                p += "W" if p[i-1]=="S" else "S"
        else:
            if p[i]=="S":
                p += "W" if p[i-1]=="S" else "S"
            else:
                p += "S" if p[i-1]=="S" else "W"
    return p
def solve():
    result = addleave("SS")
    if result[-1] == result[0]:
        if check(result):
            return result[:-1]
    result = addleave("SW")
    if result[-1] == result[0]:
        if check(result):
            return result[:-1]
    result = addleave("WS")
    if result[-1] == result[0]:
        if check(result):
            return result[:-1]

    result = addleave("WW")
    if result[-1] == result[0]:
        if check(result):
            return result[:-1]
    return -1

def check(res):
    res = res[:-1] + res[:-1] + res[:-1]
    flag = True
    for i in range(n):
        if res[n + i - 1] == res[n + i + 1] and res[n + i]=="S" and s[i]=="o":
            pass
        elif res[n + i - 1] != res[n + i + 1] and res[n + i]=="S" and s[i]=="x":
            pass
        elif res[n + i - 1] == res[n + i + 1] and res[n + i]=="W" and s[i]=="x":
            pass
        elif res[n + i - 1] != res[n + i + 1] and res[n + i]=="W" and s[i]=="o":
            pass
        else:
            flag = False
    return flag
print(solve())