Guest User

Untitled

a guest
Jan 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. use std::io::BufRead;
  2.  
  3. fn main() {
  4. let sum: i64 = std::io::stdin().lock()
  5. .lines()
  6. .flat_map(|maybe_line| maybe_line.ok().into_iter()
  7. .flat_map(|line| line.trim().parse::<i64>().ok()))
  8. .sum();
  9. println!("Sum: {}", sum);
  10. }
Add Comment
Please, Sign In to add comment