soi-io

Crates.iosoi-io
lib.rssoi-io
version0.1.3
sourcesrc
created_at2023-09-21 12:37:56.424937
updated_at2023-09-21 13:04:29.743435
descriptionA simple library for reading and writing from stdin and stdout.
homepage
repositoryhttps://github.com/TomtheCoder2/soi
max_upload_size
id979435
size5,355
Nautilus (TomtheCoder2)

documentation

README

SOI

Provides simple io for reading and writing from stdin and stdout.

Usage

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]
Commit count: 14

cargo fmt