Reverse a Rubik's Cube Algorithm Whenever you make a move on a Rubik's Cube, there is a reverse move which undoes the first move. Because of this, every algorithm (set of moves) has a reverse algorithm which undoes the first algorithm.
The goal of this challenge is to find the reverse of a given algorithm.
Specification:
The input consists of an array of individual moves. Each move is a string of length 1 or 2. Of course, you can use whatever input format makes the most sense in your language. Each move consists of the structure X or X' or X2, where X is an uppercase or lowercase letter.
To reverse X, simply replace it with X'. Likewise, X' becomes X. X2 on the other hand does not get changed.
To create the output, reverse each move, and then reverse the array.
Examples (strings separated by spaces):
R =&gt; R'
D U' =&gt; U D'
S T A C K =&gt; K' C' A' T' S'
A2 B2 =&gt; B2 A2
Scoring:
This is code-golf, so the fewest amount of bytes win. Standard loopholes are not allowed.
Python 2, 71 57 54 53 bytes

-15 bytes thanks to ovs! -3 bytes thanks to Rod.



lambda l:[i.strip("'")+" '"[len(i):]for i in l[::-1]]


Try it online!

String I/O, 70 bytes



lambda s:' '.join(i.strip("'")+"'"*(len(i)&lt;2)for i in s.split()[::-1])


Try it online!