class Program { static void Main(string[] args) { string baseWord = Console.ReadLine()!; string inputWord = Console.ReadLine()!; string outputWord = ""; foreach (char c in inputWord) { if (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8' || c == '9') { string change = c.ToString(); int num = int.Parse(change); outputWord += baseWord[num]; } else { outputWord += c; } } Console.WriteLine(outputWord); } }