You're driving along a streetcar in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to go eithercontinue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called a round trip.
Write a function (or program) that takes a string of L/R/Ss and returns (or outputs) one of two values, indicating whether the input represents a round trip.
Examples:
LLLLL -> yes (this is a drive around one pentagonal block) LLLLSRRRRS -> yes SRRSRRSRRSRR -> yes (empty sequence) -> yes R -> no LLLLLL -> no (starts with a round trip but leaves initial state) SLLLLR -> no (returns to initial street but opposite direction) (Note that L and R are not in-place rotations; every move includes entering and exiting the next intersection.)