f = ->s, n {s.chars.map.with_index(1) {|c, i| i != n ? ['*', c] : [c, '*']}.transpose.map(&:join)}puts f.('abc', 2)
Standard input is empty
*b* a*c
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!