# your code goes here a = gets b = gets b.length.times do |i| if ('0' <= b[i] && b[i] <= '9') then b[i] = a[b[i].to_i] # b[i] = a[0] end end puts b