You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
471 B
22 lines
471 B
use std::io;
|
|
|
|
pub fn read_lines() -> Vec<String> {
|
|
let mut lines = vec!();
|
|
loop {
|
|
let mut text = String::new();
|
|
let read_count = io::stdin().read_line(&mut text).unwrap();
|
|
if read_count == 0 {
|
|
break
|
|
}
|
|
if let Some(stripped) = text.strip_suffix("\n") {
|
|
text = stripped.to_string()
|
|
}
|
|
lines.push(text);
|
|
}
|
|
lines
|
|
}
|
|
|
|
pub fn read_chars() -> String {
|
|
read_lines()[0].to_owned()
|
|
}
|