Substitute a string with itself!
CJam, 11 bytes
q__1m>.{er}
Test it here.
Explanation
q__ e# Read input and make two copies.
1m> e# Rotate the second copy one character to the right.
.{er} e# For each pair of characters from the second and third string,
e# replace occurrences of the first with the second.
TeaScript, 17 bytes 19 21 24
TeaScript is JavaScript for golfing
xd(#lg(i,xC(1#a))
Nice and short
Try it online (watch for trailing whitespace in the input)
Ungolfed & Explanation
x.reduce // Reduce over input
(# // Anonymous function expands to ((l,i,a)=>
l.g( // global replace...
i // replace var i with...
x.cycle(1) // Cycle x 1
[a] // At position a
)
)
JavaScript ES6, 69 bytes
s=>[...s].reduce((p,c,i)=>p.replace(RegExp(c,'g'),s.slice(i-1)[0]),s)
F=s=>[...s].reduce((p,c,i)=>p.replace(RegExp(c,'g'),s.slice(i-1)[0]),s)
input.oninput=()=>output.innerHTML=F(input.value)
#input, #output {
width: 100%;
}
<textarea id='input' rows="5">
</textarea>
<div id="output"></div>