read lines from stdin rust code example
Example: rust read lines from stdin and return a vec
//read lines from stdin and return a vector
fn readlines() -> Vec<String> {
use std::io::prelude::*;
let stdin = std::io::stdin();
let v = stdin.lock().lines().map(|x| x.unwrap()).collect();
v
}
// sample usage
fn main() {
let f = readlines();
println!("{:?}", f);
}