Skip to content

Instantly share code, notes, and snippets.

@yeahnoob
Created May 4, 2016 13:11
Show Gist options
  • Save yeahnoob/241b568cb7b2eee38f2624ad5a244717 to your computer and use it in GitHub Desktop.
Save yeahnoob/241b568cb7b2eee38f2624ad5a244717 to your computer and use it in GitHub Desktop.
Arrays - DS
// Enter your code here
use std::io;
fn main() {
let mut in_line_1 = String::new();
let mut in_line_2 = String::new();
io::stdin().read_line(&mut in_line_1).ok().expect("Line 1 read error");
io::stdin().read_line(&mut in_line_2).ok().expect("Line 2 read error");
let n: usize = in_line_1.trim().parse().ok().expect("Parse Error");
let mut a = vec![0i32; 0];
for i in in_line_2.trim().split_whitespace().rev() {
a.push(i.parse().ok().expect("Parse Error"));
}
assert!(a.len() == n);
let ans: Vec<String> = a.iter().map(|x| x.to_string()).collect();
println!("{}", ans.join(" "));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment