diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-12-01 09:24:11 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-12-01 09:24:11 +0200 |
commit | 34bffc49705fb31f947ad0f2f45494dc9472e81b (patch) | |
tree | c9c9d4c374786cc1e89eff6a07ffcbd6ba65ee99 /src/main.rs | |
parent | c98244df602a3f3d745f5971e22b1031c3e55770 (diff) |
Day 1
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..0c24a73 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,12 @@ +use std::io; +use std::io::prelude::*; + fn main() { - println!("Hello, world!"); + let stdin = io::stdin(); + let answer = string_length_sum(stdin.lock().lines().map(|l| l.unwrap())); + dbg!(answer); +} + +fn string_length_sum(it: impl Iterator<Item = String>) -> usize { + it.map(|l| l.len()).sum() } |