Problem:


Score: 200 points

Problem Statement

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.

Constraints

S is a string of length between 1 and 100 (inclusive).

Each character of S is L, R, U, or D.

Input

Input is given from Standard Input in the following format:

S

Output

Print Yes if S is easily playable, and No otherwise.

Sample Input 1

RUDLUDR

Sample Output 1

Yes

Every character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.

Every character in an even position (2-nd, 4-th, 6-th) is L, U, or D.

Thus, S is easily playable.

Sample Input 2

DULL

Sample Output 2

No

The 3-rd character is not R, U, nor D, so S is not easily playable.

Sample Input 3

UUUUUUUUUUUUUUU

Sample Output 3

Yes

Sample Input 4

ULURU

Sample Output 4

No

Sample Input 5

RDULULDURURLRDULRLR

Sample Output 5

Yes



Sample input:
RUDLUDR


Sample output:
Yes

Submission status: Accepted

Solution code:
S = input()
answer = 'Yes'
for i in range(len(S)):
    if S[i] == 'R' and i % 2 == 1:
        answer = 'No'
        break
    elif S[i] == 'L' and i % 2 == 0:
        answer = 'No'
        break
print(answer)

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(N):
  if S[i] == 'U' or S[i] == 'D':
    continue
  else:
    if i % 2 == 0 and S[i] == 'R':
      continue
    elif i % 2 == 1 and S[i] == 'L':
      continue
  print("No")
  exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
O = ["R", "U", "D"]
E = ["L", "U", "D"]
for i in range(N):
    if i%2 == 0:
        if S[i] not in O:
            print("No")
            exit()
    else:
        if S[i] not in E:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    S = input()
    length = len(S)
    for i in range(length):
        if i % 2 == 0:
            # 奇数番目
            if S[i] not in ["R", "U", "D"]:
                print("No")
                sys.exit()
        else:
            if S[i] not in ["L", "U", "D"]:
                print("No")
                sys.exit()
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
cond = True
for i in range(0,len(S),2):
	if S[i] == "L":
		cond = False
for i in range(1,len(S),2):
	if S[i] == "R":
		cond = False

if cond == True:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s = input()

l = len(s)

ok = True
for i in range(l):
    if i % 2 == 1:
        if s[i] == 'R':
            ok = False
    if i % 2 == 0:
        if s[i] == 'L':
            ok = False

print("Yes" if ok else "No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
f = True
for i in range(N):
  if i%2 == 1:
    if S[i] == "L" or S[i] == "U" or S[i] == "D":
      pass
    else:
      f = False
  else:
    if S[i] == "R" or S[i] == "U" or S[i] == "D":
      pass
    else:
      f = False
    
if f:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
s=input()

for i in range(len(s)):
    if i%2==0:
        if s[i]=="L":
            print("No")
            quit()
    if i%2==1:
        if s[i]=="R":
            print("No")
            quit()

print("Yes")

Submission status: Accepted

Solution code:
import sys
S = input()

for i in range(len(S)):
    if i%2 == 0:
        if S[i] == 'L':
            print('No')
            sys.exit()
    else:
        if S[i] == 'R':
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()
odd = S[::2]
even = S[1::2]
if ('L' in odd) or ('R' in even):
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys, random
mod = 1000000007
def get_array(): return list(map(int, sys.stdin.readline().split()))
def get_ints(): return map(int, sys.stdin.readline().split())
def input(): return sys.stdin.readline()
def print_array(a): print(" ".join(map(str, a)))
def main():
        s = input().strip()
        l = len(s)
        flag = True
        for i in range(0, l):
                if (i % 2 == 0) and s[i] not in ['R', 'U', 'D']:
                        flag = False
                        break
                if i % 2 == 1 and s[i] not in ['L', 'U', 'D']:
                        flag = False
                        break
        print("Yes" if flag else "No")
if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
S = input()

o = S[::2]
e = S[1::2]

if o.count('R') + o.count('U') + o.count('D') == len(o) and e.count('L') + e.count('U') + e.count('D') == len(e) :
    print('Yes')
else :
    print('No')

Submission status: Accepted

Solution code:
s = input()

a = set()
a.add('R')
a.add('U')
a.add('D')

b = set()
b.add('L')
b.add('U')
b.add('D')

flag = 1
for i, si in enumerate(s):
    if i % 2 == 0 and si not in a:
        flag = 0

for i, si in enumerate(s):
    if i % 2 == 1 and si not in b:
        flag = 0

if flag:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()

ans = "Yes"
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            ans = "No"
    else:
        if S[i] == "R":
            ans = "No"
print(ans)

Submission status: Accepted

Solution code:
s = input()
a = ["R", "U", "D"]
b = ["L", "U", "D"]

ans = "Yes"
for i in range(len(s)):
    if i%2 == 0:
        if s[i] not in a:
            ans ="No"
    else:
        if s[i] not in b:
            ans = "No"
print(ans)

Submission status: Accepted

Solution code:
S = input()
a = [["R","U","D"],["L","U","D"]]
for i in range(len(S)):
    if not S[i] in a[i%2]:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
i=0
f=0
for ss in s:
    if i%2==0:
        if ss=='L':
            f=1
            break
    else:
        if ss=="R":
            f=1
            break
    i+=1
if f==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()

ans = 'Yes'
for i, s in enumerate(S):
    if (i+1)%2==1:
        if s=='L':
            ans = 'No'
    else:
        if s=='R':
            ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    if i%2 == 0:
        if s[i]=='L':
            print('No')
            exit()
    if i%2 == 1:
        if s[i]=='R':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
import sys
import math
import re

a = input()
for i in range(len(a)):
    if i%2 == 0: #guusuu
        if a[i]=="L":
            print('No')
            sys.exit()
    else:
        if a[i]=="R":
            print('No')
            sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
# ABC141
def main():
    S = input().rstrip()
    odd, even = set(S[::2]), set(S[1::2])
    flg = odd <= {"R", "U", "D"} and even <= {"L", "U", "D"}
    print("Yes" if flg else "No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = input()
odd, even = S[::2], S[1::2]
print('Yes' if set(odd) <= set('RUD') and set(even) <= set('LUD') else 'No')

Submission status: Accepted

Solution code:
S=input()
r=1
for i,c in enumerate(S):
    if i%2==0 and c=='L' or i%2==1 and c=='R':
        r=0
print(['No','Yes'][r])

Submission status: Accepted

Solution code:
S=input()
ans=True
for i in range(len(S)):
  if i%2==0:
    if S[i] not in ('R', 'U', 'D'):
      ans=False
      break
  else:
    if S[i] not in ('L', 'U', 'D'):
      ans=False
      break
print(("No","Yes")[ans])

Submission status: Accepted

Solution code:
S = input()
S_o = S[::2]
S_e = S[1::2]
if 'L' in S_o or 'R' in S_e:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = input()
ans = "Yes"
for key,i in enumerate(s):
  if (key+1) % 2:
    if i == "L":
      ans = "No"
      break
  else:
    if i == "R":
      ans = "No"
      break
print(ans)

Submission status: Accepted

Solution code:
import sys

S = input()
for i in range(len(S)):
    if i % 2 == 0:
        if not (S[i] == 'R' or S[i] == 'U' or S[i] == 'D'):
            print("No")
            sys.exit()
    else:
        if not (S[i] == 'L' or S[i] == 'U' or S[i] == 'D'):
            print("No")
            sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
n = input()
count = 0

for i in range(len(n)):
    if i % 2 ==0 and n[i] == "L":
        count += 1
    elif i % 2 ==1 and n[i] == "R":
        count += 1

if count >= 1:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = input()
flag = True
for i, s in enumerate(S):
    if i % 2 == 0:
        if s == "L":
            flag = False
            break
    else:
        if s == "R":
            flag = False
            break

if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = list(input())
ok = True
for i, c in enumerate(s):
    if i % 2 == 0 and (c not in list('RUD')):
        ok = False
    if i % 2 != 0 and (c not in list('LUD')):
        ok = False
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
O = ['R','U','D']
E = ['L','U','D']
flag = True
for i in range(len(S)):
  if i%2 == 0:
    if S[i] not in O:
      flag = False
      break
  else:
    if S[i] not in E:
      flag = False
      break
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
from sys import stdin

S = stdin.readline().rstrip()

for i in range(len(S)):
    if i % 2 == 1 and S[i] == 'R':
        print('No')
        exit()
    if i % 2 == 0 and S[i] == 'L':
        print('No')
        exit()

print('Yes')

Submission status: Accepted

Solution code:
S = input()
good = 1
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "R" or S[i] == "U" or S[i] == "D":
            # print(1)
            good = good
        else:
            good = 0
    else:
        if S[i] == "L" or S[i] == "U" or S[i] == "D":
            # print(2)
            good = good
        else:
            good = 0

if not good:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s=input()
if (not "L" in s[0::2]) and (not "R" in s[1::2]):
        print("Yes")
else:
        print("No")

Submission status: Accepted

Solution code:
import sys
S=input()

for i in range(len(S)):
  if i%2==0:
    if S[i]=="L":
      print("No")
      sys.exit()
  else:
    if S[i]=="R":
      print("No")
      sys.exit()
      
print("Yes")

Submission status: Accepted

Solution code:
S = input()
odd = S[::2]
even = S[1::2]
if 'L' in odd or 'R' in even:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
import collections
import copy
import math
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
S = input()
for i in range(len(S)):
    if i%2 == 0:
        if S[i] == "L":
            print("No")
            break
    else:
        if S[i] == "R":
            print("No")
            break
    if i == len(S)-1:
        print("Yes")

Submission status: Accepted

Solution code:

s = input()
r_set = set(["R", "U", "D"])
l_set = set(["L", "U", "D"])


ans = "No"
if set(s[::2]).issubset(r_set) and set(s[1::2]).issubset(l_set):
    ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import sys
s=input()
for i in range(len(s)):
    if(i%2==0 and s[i] == "L"):
        print("No")
        sys.exit()
    elif(i%2==1 and s[i] == "R"):
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
f=True
for i in range(len(s)):
	if i%2==0:
		if s[i]=='L':f=False
	else:
		if s[i]=='R':f=False

print('Yes' if f else 'No')

Submission status: Accepted

Solution code:
n=list(input())
for i,j in enumerate(n):
    if i%2==0:
        if j in "RUD":
            continue
        else:
            print("No")
            exit()
    else:
        if j in "LUD":
            continue
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
import sys

s = input()

for si in s[0::2]:
  if si not in ["R", "U", "D"]:
    print("No")
    sys.exit(0)

for si in s[1::2]:
  if si not in ["L", "U", "D"]:
    print("No")
    sys.exit(0)

print("Yes")

Submission status: Accepted

Solution code:
s=input()

ans = 'Yes'
for i, t in enumerate(s):
    if i % 2 == 0:
        if t in ['R','U','D']:
            pass
        else:
            ans = 'No'
    else:
        if t in ['L','U','D']:
            pass
        else:
            ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
s=input()
l=1>0
for i in range(len(s)):
    p=s[i]
    if (i%2==0 and p=="L") or (i%2==1 and p=="R"):
        l=1<0
if l:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
from sys import stdin

s = stdin.readline().rstrip()
f = True

for i, s in enumerate(s):
  if i % 2 == 0:
    if not s in ['R', 'U', 'D']:
      f = False
      break
  else:
    if not s in ['L', 'U', 'D']:
      f = False
      break
      
if f:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str):
    flag = True
    for i, s in enumerate(S):
        if i % 2 == 0:
            if s not in ["R", "U", "D"]:
                flag = False
        else:
            if s not in ["L", "U", "D"]:
                flag = False
    if flag:
        print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    if (i + 1) % 2 and s[i] == "L":
        print("No")
        break
    elif (i + 1) % 2 == 0 and s[i] == "R":
        print("No")
        break
else: print("Yes")

Submission status: Accepted

Solution code:
a = "Yes"
data = input()

for i in range(len(data)):
  if (i%2 == 0 and data[i]=="L") or (i%2 == 1 and data[i]=="R"):
    a = "No"
print(a)

Submission status: Accepted

Solution code:
S = input()

flag=True
for i in range(len(S)):
    if i%2==0:
        if S[i]=="L":
            flag=False
            break
    else:
        if S[i]=="R":
            flag=False
            break

if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
print('Yes' if s[::2].find('L')+s[1::2].find('R') == -2 else 'No')

Submission status: Accepted

Solution code:
import re
if re.match('^([RUD][LUD])*[RUD]?$', input()):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
ok = True
for i in range(len(S)):
  c = S[i]
  if i%2 == 0:
    if c not in "RUD":
      ok = False
      break
  if i%2 == 1:
    if c not in "LUD":
      ok = False
      break
if ok:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
S = input()
easy = True
for i, s in enumerate(S):
    if i%2 == 0 and s == 'L':
        easy = False
        break
    if i%2 == 1 and s == 'R':
        easy = False
        break
print('Yes' if easy else 'No')

Submission status: Accepted

Solution code:
import math
S = input()

odds = ["R","U","D"]
evens = ["L","U","D"]
ans = "Yes"
for i,c in enumerate(S):
    if (i + 1) % 2 == 1:
        if c not in odds:
            ans = "No"
    else:
        if c not in evens:
            ans = "No"

print(ans)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    s = S()
    for i, v in enumerate(s):
        if i % 2 == 0:
            if v not in ("R", "U", "D"):
                print("No")
                return
        else:
            if v not in ("L", "U", "D"):
                print("No")
                return
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
ans = "Yes"
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == "L": ans = "No";break
    elif s[i] == "R": ans = "No";break
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
odd = s[::2]
even = s[1::2]
if 'L' in odd or 'R' in even:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = input()
judge = True
for i in range(len(S)):
    if (i+1) % 2 == 0:
        if S[i] not in {"L", "U", "D"}:
            judge = False
            break
    else:
        if S[i] not in {"R", "U", "D"}:
            judge = False
            break
if judge:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=list(input())

l=s[0::2]
r=s[1::2]

if 'L' in l or 'R' in r:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s=input()
l=len(s)
flag=0
for i in range(l):
    if i%2==0:
        if not(s[i]=='R' or s[i]=='U' or s[i]=='D'):
            flag=1
    else:
        if not(s[i]=='L' or s[i]=='U' or s[i]=='D'):
            flag=1
print('Yes' if flag==0 else 'No')

Submission status: Accepted

Solution code:
s = input()
ok = True
for i in range(len(s)):
    if i % 2 == 0 and s[i] == 'L':
        ok = False
        break
    elif i % 2 == 1 and s[i] == 'R':
        ok = False
        break

if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import math
#n,m = list(map(int, input().split()))
s= input()

ans="Yes"
for i in range(len(s)):
  if((s[i]=='L' and i%2==0)or(s[i]=='R'and i%2==1)):
    ans="No"
    
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
ans = True
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            ans = False
            break
    else:
        if S[i] == "R":
            ans = False
            break
if ans: print("Yes")
else:   print("No")

Submission status: Accepted

Solution code:
S = input()
for i,c in enumerate(S):
    if i % 2 == 0:
        if c != 'R' and c!= 'U' and c != 'D':
            print('No')
            exit()
    else:
        if c != 'L' and c!= 'U' and c != 'D':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:
s = raw_input().strip()
n = len(s)

ok = 1
for i in xrange(n):
    if i & 1:
        if s[i] not in "LUD":
            ok = 0
            break
    else:
        if s[i] not in "RUD":
            ok = 0
            break

if ok:
    print "Yes"
else:
    print "No"

Submission status: Accepted

Solution code:
def main():

    S = input()
    for i in range(len(S)):
        if i % 2 == 1 and S[i] == "R":
            return "No"
        if i % 2 == 0 and S[i] == "L":
            return "No"
    return "Yes"
if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
s = input()
def ans():
    for i in range(len(s)):
        if i%2==0:
            if s[i]!= 'R' and s[i]!= 'U' and s[i]!= 'D':
                print('No')
                return
        else:
            if s[i]!= 'L' and s[i]!= 'U' and s[i]!= 'D':
                print('No')
                return
    print('Yes')
ans()

Submission status: Accepted

Solution code:
s = input()
n = len(s)
ans = "Yes"
for i in range(0, n, 2):
    if s[i] == "L":
        ans = "No"
        break
for i in range(1, n, 2):
    if s[i] == "R":
        ans = "No"
        break
print(ans)

Submission status: Accepted

Solution code:
s = input()
t = 1
kisuulist = ["R", "U", "D"]
guusuulist = ["L", "U", "D"]
for i in s:
  if(t%2==0):
    if i not in guusuulist:
      print("No")
      exit()
  else:
    if i not in kisuulist:
      print("No")
      exit()
  t+=1
print("Yes")

Submission status: Accepted

Solution code:
s = input().strip()
odd = list('RUD')
even = list('LUD')

ok = True
for i, c in enumerate(s):
    i += 1
    if (i % 2 == 0 and c not in even) or (i % 2 == 1 and c not in odd):
        ok = False
        break
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

def main():
    S = input().strip()
    for i,c in enumerate(S):
        if i%2 == 0:
            if c == "L":
                print("No")
                return
        if i%2 == 1:
            if c == "R":
                print("No")
                return
    print("Yes")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)):
  if (i+1)%2==1:
    if not S[i] in ['R', 'U', 'D']:
      print('No')
      break
  else:
    if not S[i] in ['L', 'U', 'D']:
      print('No')
      break
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "L":
            print("No")
            break
    else:
        if S[i] == "R":
            print("No")
            break
else: print("Yes")

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'L':
            print('No')
            exit()
    else:
        if s[i] == 'R':
            print('No')
            exit()
print('Yes')

Submission status: Accepted

Solution code:

S = input()

flag = True
for i in range(len(S)):

    if i % 2 == 0 and S[i] == "L":
        flag = False
    elif i % 2 == 1 and S[i] == "R":
        flag = False

if flag:
    print ("Yes")
else:
    print ("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()

for i in range(len(s)):
    c = s[i]
    if (i+1)%2==1:
        if c not in ("R","U","D"):
            print("No")
            exit()
    else:
        if c not in ("L","U","D"):
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
a = s[0::2]
b = s[1::2]
print("Yes" if a.count("L") == 0 and b.count("R") == 0 else "No")

Submission status: Accepted

Solution code:
s=input()
for i in range(len(s)):
    if i%2==1:
        if s[i]=="R":
            print("No")
            exit()
    else:
        if s[i]=="L":
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s = input()
a = ["R", "U", "D"]
b = ["L", "U", "D"]
for i, j in enumerate(s):
    if i % 2 == 0:
        if not j in a:
            print("No")
            exit()
    else:
        if not j in b:
            print("No")
            exit()

print("Yes")

Submission status: Accepted

Solution code:
s = input()
for i, c in enumerate(s, start=1):
    if (i % 2 == 1 and c == 'L') or (i % 2 == 0 and c == 'R'):
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = input()
ans = "Yes"
for i in range(0, len(S), 2):
  if S[i] == "L":
    ans = "No"
    
for i in range(1, len(S), 2):
  if S[i] == "R":
    ans = "No"
    
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

#n = int(input())
#n,k = [int(i) for i in readline().split()]

s = input()

s1 = s[::2]
s2 = s[1::2]

ok = 1
for i in s1:
    if i == "L": ok = 0
for i in s2:
    if i == "R": ok = 0


if ok:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
ju=True
n=len(s)
for i in range(n):
    if i%2==0:
        if s[i]=='L':
            ju=False
    else:
        if s[i]=='R':
            ju=False
if ju:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()


def main():
    for i, c in enumerate(s):
        if i % 2 == 0:
            if c in {'R', 'U', 'D'}:
                pass
            else:
                return False
        if i % 2 == 1:
            if c in {'L', 'U', 'D'}:
                pass
            else:
                return False
    return True


if main():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


def main():
	s = input()
	for i in range(math.ceil(len(s)/2)):
		if(s[i*2]not  in ['R','U','D']):
			print('No')
			exit()
	for i in range(math.floor(len(s)/2)):
		if(s[i*2+1]not  in ['L','U','D']):
			print('No')
			exit()
	print('Yes')


def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)):
  if S[i] == "R" and i % 2:
    print("No")
    exit(0)
  if S[i] == "L" and i % 2 == 0:
    print("No")
    exit(0)
print("Yes")

Submission status: Accepted

Solution code:
#B問題
S = list(str(input()))
N = len(S)
flag = 0
for i in range(N):
    if i%2 == 0:
        if S[i] == "L":
            flag = 1
            break
    else:
        if S[i] == "R":
            flag = 1
            break
            
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
for i, j in enumerate(s):
    if i % 2 == 0:
        if j != "L":
            continue
        else:
            print("No")
            exit()
    else:
        if j != "R":
            continue
        else:
            print("No")
            exit()
print("Yes")

Submission status: Accepted

Solution code:
s=input()
s=list(s)
ct=0
for i in range(len(s)):
    if s[i]=='R' and (i+1)%2==0:
        ct=1
    if s[i]=='L' and (i+1)%2==1:
        ct=1
if ct==1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
s=input().rstrip()
n=len(s)
for i in range(n):
    if i%2==0:
        if s[i]=='L':
            print('No')
            sys.exit()
    else:
        if s[i]=='R':
            print('No')
            sys.exit()
print('Yes')

Submission status: Accepted

Solution code:
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
ch = True
S=input()
for i,s in enumerate(S):
	if i%2==0 and s=="L":
		ch = False
		break
	if i%2==1 and s=="R":
		ch = False
		break
if ch:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  s=list(S())

  for i,x in enumerate(s):
    if i%2==0:
      if x in ['R','U','D']:
        pass
      else:
        return 'No'
    else:
      if x in ['L','U','D']:
        pass
      else:
        return 'No'
  return 'Yes'

# main()
print(main())

Submission status: Accepted

Solution code:
S = input()
flag = True
for i in range(len(S)):
  s = S[i]
  if i % 2 == 0:
    if s == "L":
      flag = False
  else:
    if s == "R":
      flag = False
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
s = input()
ans = "Yes"
for i, c in enumerate(s):
    if i % 2 == 0:
        if c == "L":
            ans = "No"
    else:
        if c == "R":
            ans = "No"
print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

s = input()
l = ["R", "U", "D"]
r = ["L", "U", "D"]
flag = True
for c in s[1::2]:
    if c not in r:
        flag = False
        break
for c in s[0::2]:
    if c not in l:
        flag = False
        break
print('Yes' if flag else 'No')

Submission status: Accepted

Solution code:
s = input()
frag = 0
for i in range(len(s)):
    if(i % 2 == 0):
        if(s[i] == 'L'):
            frag = 1
    else:
        if(s[i] == 'R'):
            frag = 1
if(frag == 0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S=input()
O = ["R","U","D"]
E = ["L","U","D"]

for k in range(len(S)):
    if k%2 == 0:
        if S[k] not in O:
            print("No")
            exit(0)
    else:
        if S[k] not in E:
            print("No")
            exit(0)
print("Yes")

Submission status: Accepted

Solution code:
S = list(input())

flg = True
for i in range(len(S)):
    if (i+1)%2 == 1 and S[i] == 'L':
        flg = False
        break
    elif (i+1)%2 == 0 and S[i] == 'R':
        flg = False
        break
if flg:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(0,N,2):
  if S[i] == "L":
    print("No")
    exit()
for i in range(1,N,2):
  if S[i] == "R":
    print("No")
    exit()
print("Yes")