Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::io::BufRead;
- fn main() {
- let sum: i64 = std::io::stdin().lock()
- .lines()
- .flat_map(|maybe_line| maybe_line.ok().into_iter()
- .flat_map(|line| line.trim().parse::<i64>().ok()))
- .sum();
- println!("Sum: {}", sum);
- }
Add Comment
Please, Sign In to add comment