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:
import os, sys, re, math

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:
S = input()

tap_flag = True
for i in range(len(S)):
    if (i+1) % 2 == 0:
        if S[i] == "R":
            tap_flag = False
            break
    elif (i+1) % 2 == 1:
        if S[i] == "L":
            tap_flag = False
            break

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

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:
ss = input()
easy = True
tap = [['R', 'U', 'D'], ['L', 'U', 'D']]
for i, s in enumerate(ss):
	if s not in tap[i % 2]:
		easy = False
print ('Yes' if easy else 'No')

Submission status: Accepted

Solution code:
S = input()
count = 0
for idx, s in enumerate(S):
    if (idx + 1) % 2:
        count += s in ['R', 'U', 'D']
    else:
        count += s in ['L', 'U', 'D']

print('Yes' if count == len(S) else 'No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = input()
odd = 'RUD'
even = 'LUD'
ans = 'Yes'
for i in range(len(s)):
    c = s[i]
    if (i+1) % 2 != 0:
        if c == 'L':
            ans = 'No'
    else:
        if c == '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()
  else:
    if S[i] == 'R':
      print('No')
      exit()
print('Yes')

Submission status: Accepted

Solution code:
S = input()

for i, alp in enumerate(S):
    if i % 2 != 0 and alp == "R":
        print("No")
        exit(0)
    if i % 2 == 0 and alp == "L":
        print("No")
        exit(0)
print("Yes")

Submission status: Accepted

Solution code:
S = input()
odd = S[0::2]
even = S[1::2]
ans = 'No'

if 'L' not in odd:
    if 'R' not in even:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
import sys

S = list(input())

for i in range(len(S)):
    if (i+1) % 2 == 1:
        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()
for i in range(len(s)):
  if i%2==0 and s[i]=='L':
    print('No')
    break
  elif i%2==1 and s[i]=='R':
    print('No')
    break
else:
  print('Yes')

Submission status: Accepted

Solution code:
s = input()
count = 0
for i in range(len(s)):
  if i % 2 == 0:
    if s[i] =="R" or s[i] =="U" or s[i] =="D":
      count += 1
  else:
    if s[i] =="L" or s[i] =="U" or s[i] =="D":
      count += 1

if len(s) == count:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys

s = list(input())
n = len(s)
for i in range(n):
    if (i+1)%2 ==0:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            continue
        else:
            print('No')
            sys.exit()
    else:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            continue
        else:
            print('No')
            sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
s = str(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()

answer = 'Yes'

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

Submission status: Accepted

Solution code:
S=input()
for id,x in enumerate(S):
  if id % 2 == 0:
    if (x not in ["R","U","D"]):
      print("No")
      break
  if id % 2 == 1:
    if (x not in ["L","U","D"]):
      print("No")
      break
else:
  print("Yes")

Submission status: Accepted

Solution code:
# ABC141B

s = input()
if len(set(s[0::2]) - set(['R', 'U', 'D'])) == 0 and\
    len(set(s[1::2]) - set(['L', 'U', 'D'])) == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
from itertools import cycle

bad = cycle('LR')

for c in input():
    if c == next(bad):
        print('No')
        break
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
k=['R','U','D']
g=['L','U','D']
for i in range(n):
  if (i+1)%2!=0 and s[i] not in k:
    print('No')
    exit()
  elif (i+1)%2==0 and s[i] not in g:
    print('No')
    exit()
print('Yes')

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()
even = S[::2]
odd = S[1::2]
if "L" in even or "R" in odd:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
s = input()
lis1 = ['R','U','D']
lis2 = ['L','U','D']
if all(i in lis1 for i in s[::2]) and all(j in lis2 for j in s[1::2]):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
num=len(s)
cnt=0
for i in range(1,len(s)+1):
    if i%2!=0:
        if s[i-1]=="R" or s[i-1]=="U" or s[i-1]=="D":
            cnt+=1
    else:
        if s[i-1]=="L" or s[i-1]=="U" or s[i-1]=="D":
            cnt+=1
if num==cnt:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s = input()
a = 'R U D'
b = 'L U D'
for i, num in enumerate(s):
  if i % 2==0:
    if num in a:
      continue
    else:
      print('No')
      sys.exit()
  else:
    if num in b:
      continue
    else:
      print('No')
      sys.exit()
print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

s = input()
text1 = 'R U D'
text2 = 'L U D'

for i, num in enumerate(s):
  if(i % 2 == 0):
    if(num in text1):
      continue
    else:
      print('No')
      sys.exit()
  else:
    if(num in text2):
      continue
    else:
      print('No')
      sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
s = input()

s1 = s[::2]
s2 = s[1::2]
if "L" in s1:
    print("No")
elif "R" in s2:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
odds = S[0::2]
evens = S[1::2]

good_odd = ['R', 'U', 'D']
good_even = ['L', 'U', 'D']

for odd in odds:
    if odd in good_odd:
        pass
    else:
        print('No')
        exit()
for even in evens:
    if even in good_even:
        pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Accepted

Solution code:
s = input()
ok = True
for i in range(len(s)):
    if (i+1) % 2 == 0:
        if s[i] != 'L' and s[i] != 'D' and s[i] != 'U':
            ok = False
            break
    else:
        if s[i] != 'R' and s[i] != 'D' and s[i] != 'U':
            ok = False
            break
if ok:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
import sys
s = input()
lst1 = list(s[::2])
lst2 = list(s[1::2])
for i in lst1:
    if i ==  "R" or i== "U" or i== "D":
        a = "Yes"
    else:
         a = "No"
         print(a)
         sys.exit()
for j in lst2:
    if j ==  "L" or j== "U" or j== "D":
        a = "Yes"
    else:
        a = "No"
        print(a)
        sys.exit()
print(a)

Submission status: Accepted

Solution code:
s=input()
n=0
for i in range(len(s)):
        if 2*i<=len(s)-1: 
            if s[2*i]=="R" or s[2*i]=="U" or s[2*i]=="D":n+=1
for i in range(len(s)):
        if 2*i+1<=len(s)-1:
            if s[2*i+1]=="L" or s[2*i+1]=="U" or s[2*i+1]=="D":n+=1
print("Yes" if n==len(s) else "No")

Submission status: Accepted

Solution code:
s = input()
cnt = 0
for i in range(1, len(s)+1):
    t = s[i-1]
    if i % 2 == 1:
        if t == 'R':
            cnt += 1
        elif t == 'U':
            cnt += 1
        elif t == 'D':
            cnt += 1
    else:
        if t == 'L':
            cnt += 1
        elif t == 'U':
            cnt += 1
        elif t == 'D':
            cnt += 1


if cnt == len(s):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
S = input()
O = ['R','U','D']
E = ['L','U','D']
ans = 'Yes'
for i in range(len(S)):
    if ((i+1)%2 != 0) and (S[i] not in O):
        ans = 'No'
    elif ((i+1)%2 == 0) and (S[i] not in E):
        ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit

# getarr = lambda _f: list(map(_f, input().split()))

s = input()

ok = True

for i, c in enumerate(s):
    if i & 1 == 0:
        if c == "L":
            ok = False
            break
    else:
        if c == "R":
            ok = False
            break

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

Submission status: Accepted

Solution code:
s = input()
print("Yes" if all((s[i] in "RUD" and i%2==0) or (i%2!=0 and s[i] in "LUD") for i in range(len(s))) else "No")

Submission status: Accepted

Solution code:
odd = ["R","U","D"]
even = ["L","U","D"]
s = input()
for i in range(len(s)):
  if i%2 == 0:
    if s[i] not in odd:
      print("No")
      exit()
  elif i%2 == 1:
    if s[i] not in even:
      print("No")
      exit()
print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
print("Yes" if all((i%2==0 and s[i] in "RUD") or (i%2!=0 and s[i] in "LUD") for i in range(len(s))) else "No")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


s = S()
n = len(s)

for i in range(n):
    if i % 2 == 0 and not s[i] in "RUD":
        print("No")
        exit()
    elif i % 2 == 1 and not s[i] in "LUD":
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
lst=list(str(input()))
cnt=0
for i in range(len(lst)):
  if i%2==0:
    if lst[i]=="L":
      cnt+=1
  else:
    if lst[i]=="R":
      cnt+=1
if cnt==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    s = input()
    ans = solve(s)
    print(ans)


def solve(s):
    if not all([(c in ['R', 'U', 'D']) for c in s[::2]]):
        return 'No'
    if not all([c in ['L', 'U', 'D'] for c in s[1::2]]):
        return 'No'
    return 'Yes'


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
cnt = 0
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
    cnt += 1
if cnt == len(s):
    print('Yes')

Submission status: Accepted

Solution code:
s = input()

x = len(s)

cnt = 1

ans = 0

for i in s:
    if cnt == 1:
        cnt = 0
        if i != "L":
            ans += 1
    else:
        cnt = 1
        if i != "R":
            ans += 1

if ans == x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
S = input()

for i, s in enumerate(S):
    if i%2==0:
        if s not in ["R", "U", "D"]:
            print("No")
            sys.exit()
    else:
        if s not in ["L", "U", "D"]:
            print("No")
            sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
S=list(input())
a=S[::2]
b='Yes'
for i in a:
  if i!='R' and i!='U' and i!='D':
    b='No'
    break
c=S[1::2]
for j in c:
  if j!='L' and j!='U' and j!='D':
    b='No'
    break
print(b)

Submission status: Accepted

Solution code:
s=input();print("YNeos"['L'in s[0::2]or'R'in s[1::2]::2])

Submission status: Accepted

Solution code:
# B - Tap Dance

S = str(input())
ans = 'Yes'
for i in range(1, len(S) + 1):
    if i % 2 != 0 and S[i - 1] == 'L':
        ans = 'No'
    if i % 2 == 0 and S[i - 1] == 'R':
        ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
S = input()
flg = 0
for i,s in enumerate(S):
    if i % 2 == 0:
        if s == 'L':
            flg = 1
    else:
        if s == 'R':
            flg = 1

if flg == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
print("Yes" if all((i%2==0 and s[i] in "RUD") or (i%2!=0 and s[i] in "LUD") for i in range(len(s))) else "No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
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 LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
def LILI(n): return [LI() for _ in range(n)]
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main_1(): 
    text = (['Sunny', 'Cloudy'], ['Cloudy', 'Rainy'],['Rainy','Sunny'])
    s = SI()
    for i in text:
        if s == i[0]:
            print(i[1])

def main(): 
    s = SI()
    for num, i in enumerate(s):
        if num % 2 == 1: # even
            if not (i in 'LUD'):
                print('No')
                return
        else:
            if not (i in 'RUD'):
                print('No')
                return
    print('Yes')

main()

Submission status: Accepted

Solution code:

S = input()

print("No" if "L" in S[::2] or "R" in S[1::2] else "Yes")

Submission status: Accepted

Solution code:
s = list(input())
for i in range(len(s)):
    if i%2==0:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            s[i] = '*'
    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            s[i] = '*'
print(['No','Yes'][set(s)=={'*'}])

Submission status: Accepted

Solution code:
S =input()

print('No' if 'L' in S[::2] or 'R' in S[1::2] else 'Yes')

Submission status: Accepted

Solution code:
s = input()
l = len(s)

ans = 'Yes'
isOdd = True
for i in range(l):
    if isOdd:
        if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
            isOdd = False
            continue
        else:
            ans = 'No'
            break
    else:
        if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
            isOdd = True
            continue
        else:
            ans = 'No'
            break

print(ans)

Submission status: Accepted

Solution code:
import sys
S=list(input())

#print(S[0::2])
for i in S[0::2]:
    if i!="R" and i!="U" and i!="D":
        print("No")
        sys.exit()
for i in S[1::2]:
    if i!="L" and i!="U" and i!="D":
        print("No")
        sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
odd = set(['R','U','D'])
even = set(['L','U','D'])
s = input()
ans = 'Yes'
for i,v in enumerate(s):
  if i % 2 != 0 and v not in even:
    ans = 'No'
    break
  elif i % 2 == 0 and v not in odd:
    ans = 'No'
    break

print(ans)

Submission status: Accepted

Solution code:
S = list(input())

odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

for i, s in enumerate(S):
    if (i + 1) % 2 == 1 and (s not in odd):
        print("No")
        exit()
    if (i + 1) % 2 == 0 and (s not in even):
        print("No")
        exit()

print("Yes")

Submission status: Accepted

Solution code:
s = str(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
flag = True

for i in range(len(s)):

    if i%2==1:
        if s[i] not in even:
            flag = False
            break

    elif i%2==0:
        if s[i] not in odd:
            flag = False
            break

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

Submission status: Accepted

Solution code:
S=list(input())

odd = [S[i] for i in range(len(S)) if i%2==0]

even = [S[i] for i in range(len(S)) if i%2!=0]

flg=0
for s in odd:
    if s=='R' or s=='U' or s=='D':
        flg+=0
    else:
        flg+=1

for s in even:
    if s=='L' or s=='U' or s=='D':
        flg+=0
    else:
        flg+=1

if flg !=0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
s = str(input())
tf = True
for i,letter in enumerate(s):
  if (i) % 2 == 0:
    if letter not in ['R','U','D']:
      tf = False
  if (i) % 2 == 1:
    if letter not in ['L','U','D']:
      tf = False
if tf:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
S = list(input())
for i in range(len(S)):
  if i % 2 == 0 and S[i] not in odd:
    print('No')
    exit()
  elif i % 2 == 1 and S[i] not in even:
    print('No')
    exit()

print('Yes')

Submission status: Accepted

Solution code:
a=input()

if set(a[0::2])<=set(['R','U','D']) and set(a[1::2])<=set(['L','U','D']):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
S=input()
n=0
for i in S:
    if (n%2==0 and i=="L") or (n%2==1 and i=="R"):
        print('No')
        exit()
    n+=1

print('Yes')

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'
            break
    else:
        if s[i]=='R':
            ans='No'
            break
print(ans)

Submission status: Accepted

Solution code:
S = input()

o = set(list(S[::2]))
e = set(list(S[1::2]))

if "L" in o or "R" in e:
  print("No")
  
else:
  print("Yes")

Submission status: Accepted

Solution code:
S = list(input())

O = [S[i] for i in range(len(S)) if i % 2 == 0]
E = [S[i] for i in range(len(S)) if i % 2 == 1]

if "L" in O or "R" in E:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
ans = 0
odd = []
even = []

i = 0
while i < len(S):
  odd.append(S[i])
  i += 2
    
j = 1
while j < len(S):
  even.append(S[j])
  j += 2
    
if ('L' not in odd) and ('R' not in even):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
cnt = 1
for i in s:
    if (cnt % 2 == 1 and i == 'L') or (cnt % 2 == 0 and i == 'R'):
        print('No')
        exit()
    cnt+=1
print('Yes')

Submission status: Accepted

Solution code:
s = input()


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


func(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
o="RUD"
g="LUD"

s=input()

i=0
while i<len(s):
  #print(s[i],i%2)
  if i%2==0:
    if s[i] =="L":
      print("No")
      exit()
  else:
    if s[i]=="R":
      print("No")
      exit()
  i+=1
  
print("Yes")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:

s=list(input())

odd=s[0::2]
even=s[1::2]
set_o=set(odd)
set_e=set(even)
if set_o<=set('RUD') and set_e<=set('LUD'):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
s=input()
ss=len(s)
c=0

for i in range(0,ss//2):
  if s[2*i]=="R"or s[2*i]=="U"or s[2*i]=="D":
    c=c+1
  if s[2*i+1]=="L"or s[2*i+1]=="U"or s[2*i+1]=="D":
    c=c+1
    
if ss%2==0:
  if c==ss:
    print("Yes")
  else:
    print("No")
else:
  if c==ss-1 and (s[-1]=="R"or s[-1]=="U"or s[-1]=="D"):
    print("Yes")
  else:
    print("No")

Submission status: Accepted

Solution code:
s = input()
odds = [s[i] for i in range(len(s)) if i % 2 == 0]
evens = [s[i] for i in range(len(s)) if  i % 2 == 1]
if odds.count('L') > 0:
  print('No')
elif evens.count('R') > 0:
  print('No')
else:
  print('Yes')

Submission status: Accepted

Solution code:
S = input()

kisu = S[0::2]
gusu = S[1::2]
kisu = kisu.replace("R", "")
kisu = kisu.replace("U", "")
kisu = kisu.replace("D", "")
gusu = gusu.replace("L", "")
gusu = gusu.replace("U", "")
gusu = gusu.replace("D", "")

if len(kisu) == len(gusu) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    S = input()
    S_o = [S[i] for i in range(0, len(S)) if i % 2 == 0]
    S_e = [S[i] for i in range(0, len(S)) if not i % 2 == 0]
    if S_o.count('L') > 0:
        print('No')
    elif S_e.count('R') > 0:
        print('No')
    else:
        print('Yes')


main()

Submission status: Accepted

Solution code:
S = input()
length = len(S)

tap = True
for i in range(length):
    if (i + 1) % 2 == 1 and S[i] == "L":
        tap = False
    elif (i + 1) % 2 == 0 and S[i] == "R":
        tap = False

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

Submission status: Accepted

Solution code:
S = list(input())
flg = True
for i in range(0,len(S),2):
    if S[i] == 'L':
        flg = False
for j in range(1,len(S),2):
    if S[j]== 'R':
        flg = False
if flg:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
li = list(input())
od = li[0::2]
ev = li[1::2]
for i in range(len(od)):
    if od[i] == "R" or od[i] == "U" or od[i] == "D":
        pass
    else:
        print("No")
        exit()
for j in range(len(ev)):
    if ev[j] == "L" or ev[j] == "U" or ev[j] == "D":
        pass
    else:
        print("No")
        exit()
print("Yes")

Submission status: Accepted

Solution code:
from sys import exit
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")

Submission status: Accepted

Solution code:
S=str(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 ss in range(len(s)):
    if (ss+1) % 2 == 0 and s[ss] == 'R':
        flag = False
        break
    if (ss+1) % 2 == 1 and s[ss] == 'L':
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')

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()
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
print("Yes" if flag else "No")

Submission status: Accepted

Solution code:
s=input()
n=len(s)
list1=['R','U','D']
list2=['L','U','D']
listg=[]
listk=[]
for i in range(n):
  if i%2!=0:
    listg.append(i)
  else:
    listk.append(i)
list3=[]
for g in listg:
  if s[g] in list2:
    list3.append(g)
list4=[]
for k in listk:
  if s[k] in list1:
    list4.append(k)
if len(list3)==len(listg) and len(list4)==len(listk):
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
import math
S=input()
count=0
for i in range(len(S)):
    if(i%2==0):
        if(S[i]=="R" or S[i]=="U" or S[i]=="D"):
            count=count+1
    else:
        if(S[i]=="L" or S[i]=="U" or S[i]=="D"):
            count=count+1
if(count==len(S)):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s=input()
ans=True
for i,string in enumerate(s):
    if i%2!=0:
        if string not in "LUD":
            ans=False
            break
    else:
        if string not in "RUD":
            ans=False
            break
print("Yes" if ans else "No")

Submission status: Accepted

Solution code:
def main():
    s = input()
    ans = 'Yes'
    
    for i in range(len(s)):
        if i % 2 == 0 and bool(s[i] not in {'R', 'U', 'D'}):
            ans = 'No'
            break
        elif i % 2 == 1 and bool(s[i] not in {'L', 'U', 'D'}):
            ans = 'No'
            break
    
    print(ans)

main()

Submission status: Accepted

Solution code:
S = input()
flag = True

for i in range (0, len(S), 2):
  if S[i] == "L":
    print("No")
    flag = False
    exit()

for j in range (1, len(S), 2):
  if S[j] == "R":
    print("No")
    flag = False
    exit()
    
if flag == True:
  print("Yes")

Submission status: Accepted

Solution code:
S = input()
flag = True
odd = "RUD"
even = "LUD"

for i in range(len(S)):
  if i % 2 == 0 and odd.count(S[i]) == 0:
    flag = False
    break
  elif i % 2 != 0 and even.count(S[i]) == 0:
    flag = False
    break

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

Submission status: Accepted

Solution code:
s = input()
x = len(s) - 1
m = 0
n = 1
c = 0
while m <= x:
  if s[m] == 'L':
    c += 1
  m += 2
while n <= x:
  if s[n] == 'R':
    c += 1
  n += 2
if c == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = input()
s_odd = s[::2]
s_even = s[1::2]
if "L" in s_odd or "R" in s_even:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 0
flag = "ok"
for i in s:
    #print(i)
    count += 1
    if count % 2 == 0:
        if i == "R":
            flag = "ng"
            break
    else:
        if i == "L":
            flag = "ng"
            break
if flag == "ok":
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
s = input()

for i in range(0, len(s), 2):
    if s[i] == 'L':
        print('No')
        sys.exit()
for i in range(1, len(s), 2):
    if s[i] == 'R':
        print('No')
        sys.exit()
print('Yes')