#region ccfuncs import strutils type TypeInt = typedesc[int] TypeString = typedesc[string] proc read(a: TypeString): string {.used.} = stdin.readLine proc read(a: TypeInt, b: TypeInt): (int, int) {.used.} = let data = read(string).split (data[0].parseInt, data[1].parseInt) proc answer(n: int) {.used.} = echo n #endregion let a = read(string) let s = read(string) for e in s: stdout.write: if isDigit(e): a[parseInt($e)] else: e stdout.write "\n"