package yukicoder import java.util.* class Main(private val args : Array) : Runnable { override fun run() { solve(args) } private fun solve(@Suppress("UNUSED_PARAMETER") args: Array) { Scanner(System.`in`).use { sc -> val A = sc.next().toCharArray() val S = sc.next().toCharArray() for ((i, c) in S.withIndex()) { if (Character.isDigit(c)) S[i] = A[c.toInt() - '0'.toInt()] } println(S) } } } /** 確保するメモリの大きさ(単位: MB) */ private const val MEMORY: Long = 64 fun main(args: Array) { Thread.setDefaultUncaughtExceptionHandler { _: Thread?, e: Throwable -> e.printStackTrace() System.exit(1) } Thread(null, Main(args = args), "", MEMORY * 1048576L).start() }