Implement swap encoding
JavaScript (ES6), 67 bytes

f=([c,...a])=&gt;c?c+f([...a.splice(0,a.indexOf(c)).reverse(),...a]):a

Try it online!
How?
a.splice(0, n) removes and returns the first \$n\$ entries in a[] if \$n\ge1\$ or removes nothing and returns an empty array if \$n&lt;1\$. If c is not found in a[], a.indexOf(c) returns \$-1\$ and we just pass a[] unchanged to the next iteration.