use proconio::{fastout, input, marker::Bytes}; #[fastout] fn main() { input! { a: Bytes, s: Bytes, } println!("{}", output(solve(a, s))) } fn solve(a: Vec, s: Vec) -> Vec { s.into_iter() .map(|x| match x.is_ascii_digit() { true => a[(x - b'0') as usize], false => x, }) .collect() } fn output(ans: Vec) -> String { String::from_utf8(ans).unwrap() }