Question: In rust programming. Receiving this error in auto grader. --------------------------- Test Failed: ' Barry Bill Dubya Poppy Ron ' != 'Barry Bill Dubya Poppy Ron
In rust programming. Receiving this error in auto grader.
---------------------------
Test Failed: 'Barry Bill Dubya Poppy Ron ' != 'Barry Bill Dubya Poppy Ron ' - - Barry Bill Dubya Poppy Ron : Unequal fingerprint groups Barry Bill Dubya Poppy...
-----------
Modify code below to solve issue.
use std::collections::HashMap;
use std::io;
fn main() { let mut map: HashMap> = HashMap::new();
//Receive Inputs
let mut input_lines = Vec::new();
loop { let mut line = String::new();
let read_result = io::stdin().read_line(&mut line);
if (read_result.unwrap() == 0) || (line == " ") { break;
}
input_lines.push(line.trim().to_string());
}
//input into hashmap
for line in input_lines { let splits: Vec<&str> = line.split_whitespace().collect();
let finger_print = splits[0];
let name = splits[1];
map.entry(finger_print.to_string()).or_insert(Vec::new()).push(name.to_string());
}
//print hashmap values
for (_key,value) in map.iter(){ for names in value{ println!("{}",names); }
if _key != map.keys().last().unwrap(){ println!(" ") }
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
