I have a string "abcd". Is there any way in Mathematica such that when I apply some exchange operator $P^{ab}$ it gives me string "bacd"?
Edit:
After reading answers I felt like I did not ask my question properly.
So, I would like to have something such that I can apply multiple permutations eventually. For example:
$P^{xy}P^{xa}P^{ya}$"xya"="ayx"
$P^{ya}P^{xa}P^{xy}$"xya"="ayx"
and so on.
I am still confused as to how to implement these because the answers sort of do S[1]<>S[2] to change specific ones. Is there a way I can implement these?