package main
import (
"fmt"
)
func main() {
var input0 string
fmt.Scan(&input0)
var input1 string
fmt.Scan(&input1)
repeatedMap := map[byte]bool{}
unrepeatedStr := []byte{}
for _, b := range []byte(input0) {
if _, ok := repeatedMap[b]; ok {
continue
}
repeatedMap[b] = true
unrepeatedStr = append(unrepeatedStr, b)
}
for i := 'a'; i <= 'z' && len(unrepeatedStr) <= 26; i++ {
bi := byte(i)
if _, ok := repeatedMap[byte(bi)]; !ok {
unrepeatedStr = append(unrepeatedStr, bi)
}
}
encryptStr := []byte{}
for _, rawB := range []byte(input1) {
targetIdx := rawB - 'a'
encryptStr = append(encryptStr, unrepeatedStr[targetIdx])
}
fmt.Println(string(encryptStr))
}