# [R], 95 bytes

    \(x,y)paste(sapply(strsplit(x,"")[[1]],\(z)cwhmisc::int2B(grep(z, letters),y))[1,],collapse="")

[R]: https://www.r-project.org