Crates.io | soi-io |
lib.rs | soi-io |
version | 0.1.3 |
source | src |
created_at | 2023-09-21 12:37:56.424937 |
updated_at | 2023-09-21 13:04:29.743435 |
description | A simple library for reading and writing from stdin and stdout. |
homepage | |
repository | https://github.com/TomtheCoder2/soi |
max_upload_size | |
id | 979435 |
size | 5,355 |
Provides simple io for reading and writing from stdin and stdout.
use soi_io::{read, read_vec, read_vec_len};
fn main() {
// reads the first int from stdin
let n: i32 = read();
// reads the next 3 ints from stdin (on the same line)
let v: Vec<usize> = read_vec_len(3);
// reads the rest of the line as ints
let v2: Vec<usize> = read_vec();
println!("n: {}, v: {:?}, v2: {:?}", n, v, v2);
}
Example input:
1 2 3 4 5 6 7 8 9
Example output:
n: 1, v: [2, 3, 4], v2: [5, 6, 7, 8, 9]