Skip to main content
3 of 4
added 315 characters in body
Maël
  • 419
  • 2
  • 9

R, 90 bytes

\(x,y)Reduce(paste0,sapply(el(strsplit(x,"")),\(z)cwhmisc::int2B(grep(z, letters),y))[1,])

With R < 4.1, \ needs to be replaced with function resulting in a total of 104 bytes.

-5 bytes thanks to @pajonk.

Try it online!

Maël
  • 419
  • 2
  • 9