diff --git a/2017/rust/src/day_02.rs b/2017/rust/src/day_02.rs
new file mode 100644
index 0000000..2eafa08
--- /dev/null
+++ b/2017/rust/src/day_02.rs
@@ -0,0 +1,19 @@
+use failure::*;
+
+pub fn solve(input: &str) -> Result<String, Error> {
+ Ok(
+ input
+ .trim()
+ .split("\n")
+ .map(|row| {
+ let row: Vec<_> = row.split("\t")
+ .map(|x| x.parse::<usize>().unwrap())
+ .collect();
+ let min = row.iter().min().unwrap();
+ let max = row.iter().max().unwrap();
+ max - min
+ })
+ .sum::<usize>()
+ .to_string(),
+ )
+}
diff --git a/2017/rust/src/main.rs b/2017/rust/src/main.rs
index 2f98976..1dc42c1 100644
--- a/2017/rust/src/main.rs
+++ b/2017/rust/src/main.rs
@@ -5,6 +5,7 @@ use std::io::{self, Read};
use failure::Error;
mod day_01;
+mod day_02;
fn main() {
if let Err(e) = run() {
@@ -16,7 +17,7 @@ fn run() -> Result<(), Error> {
let mut input = String::new();
io::stdin().read_to_string(&mut input)?;
- let solution = day_01::solve(&input)?;
+ let solution = day_02::solve(&input)?;
println!("{}", solution);
Ok(())