s=gets.chomp t=gets.chomp (0...t.size).each do |i| if '0'<=t[i]&&t[i]<='9' t[i]=s[t[i].to_i] end end puts t