Created
June 20, 2024 11:03
-
-
Save bsnacks000/45985a1ceb1aed740920767c5e93d3ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // use std::fs::File; | |
| use itertools::Itertools; | |
| use std::io::{self, BufRead, BufReader, BufWriter, Write}; | |
| use serde::{Deserialize, Serialize}; | |
| // use std::path::Path; | |
| #[derive(Serialize, Deserialize)] | |
| struct Item<'a> { | |
| id: i64, | |
| val: &'a str, | |
| } | |
| fn main() -> io::Result<()> { | |
| let reader = BufReader::new(io::stdin()); | |
| let mut writer = BufWriter::new(io::stdout()); | |
| for lines in reader.lines().chunks(6).into_iter() { | |
| for (i, line) in lines.enumerate() { | |
| let l_ = format!("\tLine {}\n", i); | |
| writer.write(l_.as_bytes()).unwrap(); | |
| if let Ok(mut line) = line { | |
| line.push('\n'); | |
| writer.write(line.as_bytes()).unwrap(); | |
| } | |
| } | |
| } | |
| Ok(()) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment