Ad
Code
Diff
  • fn verify_sum(name_one: &str, name_two: &str) -> bool {
        sum(name_one) == sum(name_two)
    }
    
    fn sum(name: &str) -> u32 {
        name.chars()
            .filter(|ch| ch.is_ascii_alphabetic())
            .map(u32::from)
            .sum()
    }
    • fn verify_sum(name_one: &str, name_two: &str) -> bool {
    • sum(name_one) == sum(name_two)
    • }
    • fn sum(name: &str) -> u32 {
    • name.chars()
    • .filter(|ch| ch.is_ascii_alphabetic())
    • .map(|ch| ch as u32)
    • .map(u32::from)
    • .sum()
    • }