Problem:
Snuke, who loves animals, built a zoo.  There are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle. The animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1.  There are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies.  Snuke cannot tell the difference between these two species, and asked each animal the following question: "Are your neighbors of the same species?" The animal numbered i answered s_i. Here, if s_i is `o`, the animal said that the two neighboring animals are of the same species, and if s_i is `x`, the animal said that the two neighboring animals are of different species.  More formally, a sheep answered `o` if the two neighboring animals are both sheep or both wolves, and answered `x` otherwise. Similarly, a wolf answered `x` if the two neighboring animals are both sheep or both wolves, and answered `o` otherwise.  Snuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print `-1`.

Incorrect submission (verdict: Wrong Answer):
N = int(input())
t = list(input())
Ans = ['n' for _ in t]

def judge(prevSW, SW, ox):
    if SW == 'S':
        if ox == 'o':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'
    elif SW == 'W':
        if ox == 'x':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'

Ans[0] = 'S'
for i in range(1,N):
    if i == 1:
        Ans[i] = 'S'
    else:
        Ans[i] = judge(Ans[i-2], Ans[i-1], t[i-1])

if judge(Ans[-1], Ans[0], t[-1]) is 'S':
    print("".join(Ans))
else:
    for i in range(1,N):
        if i == 1:
            Ans[i] = 'W'
        else:
            Ans[i] = judge(Ans[i-2], Ans[i-1], t[i-1])

    print("".join(Ans))


Fixed, accepted submission:
N = int(input())
t = list(input())
Ans = ['n' for _ in t]
 
def judge(prevSW, SW, ox):
    if SW == 'S':
        if ox == 'o':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'
    elif SW == 'W':
        if ox == 'x':
            return prevSW
        else:
            if prevSW == 'S':
                return 'W'
            else: return 'S'
 
def decideorder(startSW):
    Ans[1] = startSW
    for i in range(2,N):
        Ans[i] = judge(Ans[i-2], Ans[i-1], t[i-1])

def check():
    if judge(Ans[-2], Ans[-1], t[-1]) is Ans[0] and judge(Ans[-1], Ans[0], t[0]) is Ans[1]:
        return True
    else:
        return False

Ans[0] = 'S'
decideorder('S')
if check():
    print("".join(Ans))
else:
    decideorder('W')
    if check():
        print("".join(Ans))
    else:
        Ans[0] = 'W'
        decideorder('S')
        if check():
            print("".join(Ans))
        else:
            decideorder('W')
            if check():
                print("".join(Ans))
            else:
                print(-1)