fn main() { println!("Hello, world!"); let tests = [ ("a1c1e1", "abcdef"), ("a1b2c3d4e", "abbdcfdhe") ]; for (input, output) in tests { let result = Solution::replace_digits(input.to_string()); println!("{input:?} is {result:?} should be {output:?}"); } } struct Solution; impl Solution { pub fn replace_digits(mut s: String) -> String { unsafe {s.as_bytes_mut()}.chunks_exact_mut(2).for_each(|x| x[1] = x[0] + x[1] - b'0'); s } }