git-subtree-dir: 2018 git-subtree-mainline:5ccd921b23
git-subtree-split:4f35fa8515
34 lines
772 B
Rust
34 lines
772 B
Rust
use std::collections::HashMap;
|
|
use std::error::Error;
|
|
use std::fs::File;
|
|
use std::io::BufReader;
|
|
use std::io::prelude::*;
|
|
|
|
fn main() -> std::io::Result<()> {
|
|
let mut f = File::open("input")?;
|
|
let mut data = String::new();
|
|
|
|
f.read_to_string(&mut data)?;
|
|
|
|
for lineA in data.lines() {
|
|
for lineB in data.lines() {
|
|
let mut a = lineA.chars();
|
|
let mut b = lineB.chars();
|
|
let mut diffCount = 0;
|
|
let mut pairs = a.zip(b);
|
|
|
|
for (aChar, bChar) in pairs {
|
|
if aChar != bChar {
|
|
diffCount += 1;
|
|
}
|
|
}
|
|
|
|
if diffCount == 1 {
|
|
println!("lineA: {} lineB: {}", lineA, lineB);
|
|
}
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|