use std::io::{Read, Write}; use anyhow::Context; fn main() -> anyhow::Result<()> { let mut input = std::io::stdin().lock(); let mut output = std::io::stdout().lock(); let mut output_bytes = Vec::new(); input .read_to_end(&mut output_bytes) .context("could not read stdin")?; let safe_utf8_content = String::from_utf8_lossy(&output_bytes); output .write_all(safe_utf8_content.as_bytes()) .context("could not write to stdout")?; output.flush().context("could not flush")?; Ok(()) }