Problem: Takahashi will do a tap dance. The dance is described by a string S where each character is `L`, `R`, `U`, or `D`. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.  S is said to be _easily playable_ if and only if it satisfies both of the following conditions:    * Every character in an odd position (1-st, 3-rd, 5-th, \ldots) is `R`, `U`, or `D`.   * Every character in an even position (2-nd, 4-th, 6-th, \ldots) is `L`, `U`, or `D`.  Your task is to print `Yes` if S is easily playable, and `No` otherwise.

Submission attempts (in order):
elif amari == 0:
    for i in range (1, (int(n) // 2)):
        if a[int(i) * 2 - 2] == "S":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass

elif amari == 1:
    for i in range (1, (int(n) // 2)):
        if a[int(i) * 2 - 2] == "S":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass       
    if a[int(n) - 1] == "S" and flag == "":
        print("No")
        flag = "unko"
else:
    pass

if flag == "":
    print("Yes")

a = input()
n = int(len(a))
amari = int(n) % 2
flag = str()
if n == 1:
    if a = "S":
        print("No")
        flag = "unko"
    else:
        pass

elif amari == 0:
    for i in range (1, (int(n) // 2)):
        if a[int(i) * 2 - 2] == "S":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass

elif amari == 1:
    for i in range (1, (int(n) // 2)):
        if a[int(i) * 2 - 2] == "S":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass       
    if a[int(n) - 1] == "S" and flag == "":
        print("No")
        flag = "unko"
else:
    pass

if flag == "":
    print("Yes")

# coding: utf-8
# Your code here!
a = input()
n = int(len(a))
amari = int(n) % 2
flag = str()
if n == 1:
    if a == "L":
        print("No")
        flag = "unko"
    else:
        pass
elif amari == 0:
    for i in range (1, (int(n) // 2)+1):
        if a[int(i) * 2 - 2] == "L":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass

elif amari == 1:
    for i in range (1, (int(n) // 2)+1):
        if a[int(i) * 2 - 2] == "L":
            print("No")
            flag = "unko"
            break
        elif a[int(i) * 2 - 1] == "R":
            print("No")
            flag = "unko"
            break
        else:
            pass
    if a[int(n) - 1] == "L" and flag == "":
        print("No")
        flag = "unko"
else:
    pass

if flag == "":
    print("Yes")


Verdicts: Runtime Error

Runtime Error

Accepted