Documentation

Rust
Compiler
Rust
Name
Rust
Language
Rust
Program and version
rustc 1.41.0
Description
Rust
Type
compiler
Flags1
Flags2
Extension
.rs
Status
Ok

P68688
fn main() {
    println!("Hello world!");
}
P57548
use std::io;

fn main() {
    let mut sum = 0;

    loop {
        let mut line = String::new();
        if io::stdin().read_line(&mut line).expect("Error reading line") == 0 {
            break;
        }

        for token in line.trim().split(" ") {
            if !token.is_empty() {
                let num: i32 = token.parse().expect("Not an integer");
                sum += num;
            }
        }
    }

    println!("{}", sum);
}