Created
July 11, 2017 19:25
-
-
Save alex-pat/d4e68e53b2b0b2750e45ec278c477f76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::prelude::*; | |
use std::collections::HashMap; | |
fn main() { | |
let mut input = String::new(); | |
std::io::stdin().read_to_string(&mut input).unwrap(); | |
let mut input_words = input.split_whitespace(); | |
let n: u32 = input_words.next().unwrap().parse().unwrap(); | |
let mut hashmap = HashMap::new(); | |
for _ in 0..n { | |
let key = input_words.next().unwrap(); | |
let value: u32 = input_words.next().unwrap().parse().unwrap(); | |
hashmap.insert(key, value); | |
} | |
for key in input_words { | |
match hashmap.get(key) { | |
Some(value) => println!("{}={}", key, value), | |
None => println!("Not found"), | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment