alg = "R' D R"

wheres = cubies = "UF UR UB UL DF DR DB DL FR FL BR BL UFR URB UBL ULF DRF DFL DLB DBR".split()
for move in alg.split():
    perm = "FLBR FRBL FDBU FUBD URDL ULDR".split()['UDLRFB'.index(move[0])]
    n = len(move) + move.endswith("'")
    table = ''.maketrans(perm, perm[n:] + perm[:n])
    wheres = [w.translate(table) if move[0] in w else w for w in wheres]
for c, w in zip(cubies, wheres):
    if c != w:
        print(c, 'moved to', w)