(s: String, t: String)
| 1 | pub fn find_the_difference(s: String, t: String) -> char { |
| 2 | use std::collections::HashMap; |
| 3 | let mut chars_map = HashMap::new(); |
| 4 | for c in s.chars() { |
| 5 | let counter = chars_map.entry(c).or_insert(0); |
| 6 | *counter += 1; |
| 7 | } |
| 8 | for c in t.chars() { |
| 9 | let counter = chars_map.entry(c).or_insert(0); |
| 10 | *counter -= 1; |
| 11 | } |
| 12 | chars_map.retain(|_, v| v == &-1); |
| 13 | *chars_map.keys().nth(0).unwrap() |
| 14 | } |
| 15 | |
| 16 | fn main() { |
| 17 | let s = "abcd".to_string(); |
nothing calls this directly
no outgoing calls
no test coverage detected