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 sys
A = input()
#print(len(A))
i = 0
for c in A:
    if i % 2 == 0 :
        #print(c)
        if c != 'R' and c != 'U' and c != 'D':
            print('No')
            sys.exit()
    elif i % 2 == 1:
        if c != 'L' and c != 'U' and c != 'D':
            print('No')
            sys.exit()
    i+=1
print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()
flag_1 = [i for i, si in enumerate(s) if i%2 == 0 and (si =='R' or si=='U' or si=='D')]
flag_2 = [i for i, si in enumerate(s) if i%2 == 1 and (si =='L' or si=='U' or si=='D')]
if len(flag_1) + len(flag_2)==len(s):
    output = 'Yes'
else:
    output = 'No'
print('{}'.format(output))

Submission status: Accepted

Solution code:
import sys

S= list(input())
#ループカウンタ
count =-1
#フラグ
flug =0
#奇数の数列[0,2,4,6...]の時にR,U,Dのいずれか
for i in range(len(S)):
    count +=1
    #奇数の時
    if(count %2 == 0):
        #踏みやすい場合
        if(S[count]== 'R' or S[count] == 'U' or S[count] == 'D'):
            continue
        #踏みにくい場合
        else:
            print('No')
            sys.exit()
    #偶数の場合
    if(count %2 == 1):
        if(S[count]== 'L' or S[count] == 'U' or S[count] == 'D'):
            continue
        #踏みにくい場合
        else:
            print('No')
            sys.exit()
    
print('Yes')

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']

def solve(S: str):
    for i in range(len(S)):
        if i % 2 == 0:
            if not S[i] in odd:
                print(NO)
                sys.exit(0)
        else:
            if not S[i] in even:
                print(NO)
                sys.exit(0)
    print(YES)
    return


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()

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

Submission status: Accepted

Solution code:
s=list(input())

flag = True

for i in range(len(s)):
  if i%2 != 0:
    if s[i] == 'L' or s[i] == 'U' or s[i] == 'D':
      continue
    else :
      flag = False
      break
  else:
    if s[i] == 'R' or s[i] == 'U' or s[i] == 'D':
      continue
    else :
      flag = False
      
if flag:
  print('Yes')
else :
  print('No')

Submission status: Accepted

Solution code:
s = input()
count = 0

n = len(s)
for i in s:
    count += 1
    if i == 'U' or i == 'D':
        count += 0
    elif count % 2 == 1:
        if i == 'L':
            print('No')
            break
    elif count % 2 == 0:
        if i == 'R':
            print('No')
            break
    if count == n:
        print('Yes')
        break

Submission status: Accepted

Solution code:
s = input()
odd_desired = set(["R", "U", "D"])
even_desired = set(["L", "U", "D"])
odd_actual = set(s[0::2])
even_actual = set(s[1::2])
if len(odd_actual - odd_desired) > 0 or len(even_actual - even_desired) > 0:
    print("No")
else:
    print("Yes")

Submission status: Accepted

Solution code:
import sys
s = input()

for i, tmp in enumerate(s):
 if(i%2==0 and tmp == "L"):
  print("No")
  sys.exit()
 if(i%2!=0 and tmp == "R"):
  print("No")
  sys.exit()
print("Yes")

Submission status: Accepted

Solution code:
s = str(input())

g_str = s[1::2]
k_str = s[0::2]

if "R" in g_str:
    print("No")
elif "L" in k_str:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def check( SS ):
    n = 0
    for i in SS:
        if n%2 == 0:
            if i != "R" and i != "U" and i != "D":
                return False
        elif n%2 == 1:
            if i != "L" and i != "U" and i != "D":
                return False
        n += 1
    return True


if check(S):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:

N = input()

str_list = list(N)

l = ["U", "D"]

r = "Yes"
for i, s in enumerate(str_list):

    if i == 0 or (i+1) % 2 != 0:
        if s == "R":
            continue
    else:
        if s == "L":
            continue

    if s not in l:
        r = "No"
        break

print(r)

Submission status: Accepted

Solution code:
s = input()

import sys

for i in range(len(s)):
    if (i + 1) % 2 == 1 and s[i] not in 'RUD':
        print('No')
        sys.exit(0)
    if (i + 1) % 2 == 0 and s[i] not in 'LUD':
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Accepted

Solution code:
S = input()
A = list(S)

flg = True
for i in range(len(A)):
  if i%2 == 0:
    if A[i] != 'R' and A[i] != 'U' and A[i] != 'D':
      flg = False
      break
  else:
    if A[i] != 'L' and A[i] != 'U' and A[i] != 'D':
      flg = False
      break

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

Submission status: Accepted

Solution code:
S = input()

isEasy = True
for i, v in enumerate(S):
  if ((i + 1) % 2 == 0 and (v == 'L' or v == 'U' or v == 'D')):
    continue
  elif ((i + 1) % 2 == 1 and (v == 'R' or v == 'U' or v == 'D')):
    continue
  else:
    isEasy = False
    break
  
if isEasy:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
s = list(input())
ans = "Yes"
for i,c in enumerate(s):
    if (i+1) % 2 == 0:
        if c == "L" or c == "U" or c == "D":
            continue
        else:
            ans = "No"
            break
    else:
        if c == "R" or c == "U" or c == "D":
            continue
        else:
            ans = "No"
            break    
print(ans)

Submission status: Accepted

Solution code:
S = list(input())
k = 0 
for i in range(0, len(S)):
    if (i + 1) % 2 == 0:
        if S[i] in "LUD":
            k += 1
        else:
            print("No")
            exit()
    else:
        if S[i] in "RUD":
            k += 1
        else:
            print("No")
            exit()
if k >= 1:
    print("Yes")

Submission status: Accepted

Solution code:
import sys

oddEasySteps = ['R', 'U', 'D']
evenEasySteps = ['L', 'U', 'D']

steps = input()
oddSteps = steps[::2]
evenSteps = steps[1::2]

for step in oddSteps:
  if step not in oddEasySteps:
    print('No')
    sys.exit()

for step in evenSteps:
  if step not in evenEasySteps:
    print('No')
    sys.exit()

print('Yes')

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
# import collections

# import bisect
# import math
import numpy as np
# from fractions import gcd

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)

    def lcm(self, x, y):
        return (x * y) // self.gcd(x, y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    # n, m = ip.IL()
    # a = np.array(ip.IL())
    # for _ in range(m):
    #     a[np.argmax(a)] //= 2
    # print(np.sum(a))
    s = input()
    flag = False
    for i, x in enumerate(s):
        if i % 2 == 0:
            if x == "R" or x == "U" or x == "D":
                pass
            else:
                print("No")
                flag = True
                break
        else:
            if x == "L" or x == "U" or x == "D":
                pass
            else:
                print("No")
                flag = True
                break

    if not flag:
        print("Yes")


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():    
    S = raw_input()

    A = ["R", "U", "D"]
    B = ["L", "U", "D"]

    for i,c in enumerate(S):
        if i%2 ==0:
            if c in A:
                continue
        else:
            if c in B:
                continue
            
        print "No"
        return
    
    print "Yes"

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# n = int(input())
s = input()
slist = list(s)
no = 0

for i in range(len(slist)):
  w = slist[i]
  if i % 2 == 0:
    if w != 'R' and w != 'U' and w != 'D':
      no = 1
  else:
    if w != 'L' and w != 'U' and w != 'D':
      no = 1
      
if no == 0:
  print('Yes')
elif no == 1:
  print('No')
else:
  print('Error')

Submission status: Accepted

Solution code:
s = input()

ans = True
for i in range(len(s)):
    if (i + 1) % 2 == 0:
        if s[i] == 'R':
            ans = False
    else:
        if s[i] == 'L':
            ans = False

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

Submission status: Accepted

Solution code:
def tapdance(s):
    odd = ["R","U","D"]
    even = ["L","U","D"]

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

    for i in o:
        if i not in odd:
            return print("No")
    for i in e:
        if i not in even:
            return print("No")
    return print("Yes")

s = input()
tapdance(s)

Submission status: Accepted

Solution code:
s=input()
even=["L","U","D"] #mondaide
odd=["R","U","D"]
l=len(s)
fumiyasui=False
for i in range(l):
  if i%2==0:
    if s[i] in odd:
      fumiyasui=True      
    else:
      print("No")
      exit()
  else:
    if s[i] in even:
      fumiyasui=True      
    else:
      print("No")
      exit()
print("Yes")

Submission status: Accepted

Solution code:
S = input()

if (set(S[::2]) | set("RUD") == set("RUD")) and (set(S[1::2]) | set("LUD") == set("LUD")):
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
s= input()
ans='Yes'
for i in s[::2]:
        if i not in 'RUD':
                ans='No'
                break
for j in s[1::2]:
        if j not in 'LUD':
                ans='No'
                break
print(ans)

Submission status: Accepted

Solution code:
s = input()

a = []
b = []

flag = 0

for i in range(len(s)):
    if i % 2 == 1:
        a.append(s[i])
    else:
        b.append(s[i])
        
for j in a:
    if j == 'R':
        flag += 1
        break
for k in b:
    if k == 'L':
        flag += 1
        break

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
sin = list(input())

gu = list()
ki = list()
for i, s in enumerate(sin):
    if i % 2 == 0:
        ki.append(s)
    else:
        gu.append(s)

if set(ki) <= set(['R', 'U', 'D']):
    if set(gu) <= {'L', 'U', 'D'}:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

Solution code:
s = input()

good = [["R", "U", "D"], ["L", "U", "D"]]

for i, ele in enumerate(s):
	if ele not in good[i%2]:
		print("No")
		break
else:
	print("Yes")

Submission status: Accepted

Solution code:
str = input()
order = 1
symbol = True
for c in str:
    if order % 2 == 1:
        if c not in ['R', 'U', 'D']:
            print('No')
            symbol = False
            break
    else:
        if c not in ['L', 'U', 'D']:
            print('No')
            symbol = False
            break
    order += 1

if symbol:
    print('Yes')

Submission status: Accepted

Solution code:
inputval = input()
in2 = list (inputval)
result = 1
count = 0
for i in in2:
    count += 1
    if count%2 == 1:
        if i == 'L':
            result = result * 0
    if count%2 == 0:
        if i =='R':
            result = result * 0

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

Submission status: Accepted

Solution code:
S = str(input())

test1 = ['R','U','D']
test2 = ['L','U','D']

isTapable = True

for i in range(len(S)):
    if i % 2 == 0:
        if S[i] in test1:
            isTapable = True
        else:
            isTapable = False
            break
    else:
        if S[i] in test2:
            isTapable = True
        else:
            isTapable = False
            break

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

Submission status: Accepted

Solution code:
string = input()

def jadge_humiyasui(string):
    label1 = True
    label2 = True

    for i, str in enumerate(string):
        if i % 2 == 0:
            if str not in ['R', 'U', 'D']:
                label1 = False
        else:
            if str not in ['L', 'U', 'D']:
                label2 = False

    if label1 & label2:
        print('Yes')
    else:
        print('No')

jadge_humiyasui(string)

Submission status: Accepted

Solution code:
def main():
    S = input()
    s_len = len(list(S))
    for i in range(s_len):
        s = S[i]
        ans = "Yes"
        if s == "U" or s == "D":
            pass
        else:
            if i % 2 == 0:
                if s == "R":
                    pass
                else:
                    ans = "No"
                    break
            else:
                if s == "L":
                    pass
                else:
                    ans = "No"
                    break
 
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
N = list(S)

ret = ""

for i in range(len(N)):
  if i%2 == 0:
    if N[i] == "R":
      ret = "Yes"
    elif N[i] == "U":
      ret = "Yes"
    elif N[i] == "D":
      ret = "Yes"
    else:
      ret = "No"
      break
  else:
    if N[i] == "L":
      ret = "Yes"
    elif N[i] == "U":
      ret = "Yes"
    elif N[i] == "D":
      ret = "Yes"
    else:
      ret = "No"
      break
      
print(ret)

Submission status: Accepted

Solution code:
s = list(input())
yn = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == 'L':
            yn = 1
    
    else:
        if s[i] == 'R':
            yn = 1

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

Submission status: Accepted

Solution code:
import sys

step = input()
count = 0
judge = False

for char in step:
    count = count + 1
    if count % 2 == 1:
        if char == "R" or char == "U" or char =="D":
            judge = True
        else:
            print("No")
            sys.exit()
    elif count % 2 == 0:
        if char == "L" or char == "U" or char == "D":
            judge = True
        else:
            print("No")
            sys.exit()

if judge:
    print("Yes")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

readline = stdin.readline


def main():
    s = readline().rstrip()
    UD = ('U', 'D')
    res = 'No'
    for i, c in enumerate(s):
        if c in UD:
            continue
        if i % 2 is 0:
            if c is 'L':
                break
        else:
            if c is 'R':
                break
    else:
        res = 'Yes'
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
i =input()

a=-1

for x in range(0,len(i)):
  if a==-1 and (i[x:x+1]!='R' and i[x:x+1]!='U' and i[x:x+1]!='D'):
    print('No')
    exit()
  if a==1 and (i[x:x+1]!='L' and i[x:x+1]!='U' and i[x:x+1]!='D'):
    print('No')
    exit()
  a*=-1
print('Yes')

Submission status: Accepted

Solution code:
s = input()
flag = True
flag2 = True
for char in s[::2]:
    if char =='L':
        flag = False
for char2 in s[1::2]:
    if char2 == 'R':
        flag2 = False
if (flag and flag2):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
oddStep = ['R', 'U', 'D']
evenStep = ['L', 'U', 'D']

S = input()
flag = True
for i,s in enumerate(S):
    if i % 2 != 0:
        if not s in evenStep:
            flag = False
            break
    else:
        if not s in oddStep:
            flag = False
            break

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

Submission status: Accepted

Solution code:
s = str(input())

flag = False

for i in range(len(s)):
#     print("aaa",s[i])
    if i % 2 == 0:
        if s[i] == "R" or s[i] == "U" or s[i] == "D":
#             print(s[i],"1")
            flag = True
        else:
            flag = False
            break
    elif i % 2 == 1:
        if s[i] == "L" or s[i] == "U" or s[i] == "D":
#             print(i,"2")
            flag = True
        else:
            flag = False
            break

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

Submission status: Accepted

Solution code:
is_easy = True
S = input()
for i in range(len(S)):
    if (i+1) % 2 == 0 and S[i] != "R":
        pass
    elif (i+1) % 2 == 1 and S[i] != "L":
        pass
    else:
        is_easy = False
        break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8
import sys

def main():
    a = list(input())

    for i, tap in enumerate(a):
        i = i + 1
        if i % 2 != 0:
            if tap == 'L':
                print('No')
                sys.exit()

        elif i % 2 == 0:
            if  tap == 'R':
                print('No')
                sys.exit()

    print('Yes')

if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
out = 'Yes'
str = input()
for i,s in enumerate(str):
  if s == 'L' and i%2 == 0:
    out = 'No'
  elif s == 'R' and i%2 == 1:
    out = 'No'
print(out)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
l = len(s) - 1
for i,j in enumerate(s):
  if i % 2 == 1:
    if j == "L" or j == "U" or j == "D":
      if i == l:
      	print("Yes")
      continue
    else:
      print("No")
      break
  elif i % 2 == 0:
    if j == "R" or j == "U" or j == "D":
      if i == l:
      	print("Yes")
      continue
    else:
      print("No")
      break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
print('Yes' if all(s[i] in 'LUD' if i & 1 else s[i] in 'RUD' for i in range(len(s))) else 'No')

Submission status: Accepted

Solution code:
S = list(input())
ans = "Yes"
cnt = 0
for s in S:
    if s == "U" or s == "D":
        cnt += 1
        continue
    elif cnt % 2 == 0 and s == "L":
        cnt += 1
        ans = "No"
        break
    elif cnt % 2 == 1 and s == "R":
        cnt += 1
        ans = "No"
        break
    else:
        cnt += 1

print(ans)

Submission status: Accepted

Solution code:
S = input()
S1 = S[::2]
S2 = S[1::2]
f1=S1.find('L')
f2=S2.find('R')
if (f1==-1) and (f2==-1): print("Yes")
else:print("No")

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: str(ns())
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

t1 = ni()
t1 = [t for t in t1]

result = "Yes"
for i, t in enumerate(t1) :
  if i % 2 == 0 :
    if t == "L" :
      result = "No"
      break
  else :
    if t == "R" :
      result = "No"
      break
print(result)

Submission status: Accepted

Solution code:
s = input()


for i,tap in enumerate(s):
        
        if i % 2 == 1:
                if tap == 'R':
                        print ('No')
                        exit()
        else:
                if tap == 'L':
                        print ('No')
                        exit()
else:
        print('Yes')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

l = []
for s in input():
    l.append(s)

a = ['R','U','D']
b = ['L','U','D']

ret = 'Yes'
for i in range(len(l)):
    if i % 2 == 0 and l[i] not in a:
        ret = 'No'
    elif i % 2 != 0 and l[i] not in b:
        ret = 'No'
    

print(ret)

Submission status: Accepted

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

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
    else:
        if S[i] == "R":
            Ans = "No"
            break
print(Ans)

Submission status: Accepted

Solution code:
s_ = input()

s = [c for c in s_]

even=[]
odd=[]
for i in range(len(s)):
  if i%2==0:
    odd.append(s[i])
  else:
    even.append(s[i])
    
even_=[i for i in even if i!="L" and i!="U" and i!="D"]
odd_=[i for i in odd if i!="R" and i!="U" and i!="D"]

if even_==[] and odd_==[]:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
st=input()
flag = 1
for i, s in enumerate(st):
  if i % 2 == 0:
    if s == 'R' or s == 'U' or s =='D':
      continue
    else:
      print('No')
      flag = 0
      break
  if i % 2 == 1:
    if s == 'L' or s == 'U' or s =='D':
      continue
    else:
      print('No')
      flag = 0
      break
if flag == 1:
  print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

flag = False

for i in range(len(S)):
    if i % 2 == 1:
        if S[i] == 'R':
            flag = True
            break
    else:
        if S[i] == 'L':
            flag = True
            break
            
if flag == True:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
S = list(input())

i = 0
RUD_NO = 0
while i < len(S):

    if S[i] == 'R' or S[i] == 'U' or S[i] == 'D':
        i = i + 2
    else:
        RUD_NO = 1
        break

LUD_NO = 0
i = 1
while i < len(S):

    if S[i] == 'L' or S[i] == 'U' or S[i] == 'D':
        i = i + 2
    else:
        LUD_NO = 1
        break

if LUD_NO == 0 and RUD_NO == 0:
    print('Yes')
    exit(0)

print('No')

Submission status: Accepted

Solution code:
String = input()
for i, s in enumerate(String):
    if ((i+1) % 2) == 0:
        if s == 'R':
            print('No')
            exit(0)
    else:
        if s == 'L':
            print('No')
            exit(0)

print('Yes')

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
s = input()
odd = s[::2]
even = s[1::2]
ans = 'Yes'
R = ['R','U','D']
L = ['L','U','D']
for i in odd:
    if i not in R:
        ans = 'No'
for i in even:
    if i not in L:
        ans = 'No'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
ans="Yes"
for j,i in enumerate(n):
    if j%2==1:
        if i!="L" and i!="U" and i!="D":
            ans="No"
    else :
        if  i!="R" and i!="U" and i!="D":
            ans ="No"
print(ans)

Submission status: Accepted

Solution code:
import sys
s = str(input())

n = len(s)

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

for i in range(n):
    if not ((i % 2 == 0 and s[i] in odd) or (i % 2 == 1 and s[i] in even)):
        print("No")
        sys.exit()

print("Yes")

Submission status: Accepted

Solution code:
S = list(input())
list1 = []
list2 = []
for i in range(len(S)):
    if i % 2 == 0:
        list1.append(S[i])
    else:
        list2.append(S[i])
if not "L" in list1 and not "R" in list2:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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