Add day4
This commit is contained in:
@@ -2,7 +2,7 @@ use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
fn main() {
|
||||
let content = fs::read_to_string("inputTest.txt").expect("Could not read file");
|
||||
let content = fs::read_to_string("input.txt").expect("Could not read file");
|
||||
let lines: Vec<&str> = content.lines().collect();
|
||||
|
||||
let mut output_sum = 0;
|
||||
@@ -29,7 +29,7 @@ fn main() {
|
||||
if let Some(line) = lines.get(index1) {
|
||||
if index2 < lines[index1].len() {
|
||||
if let Some(character) = line.chars().nth(index2) {
|
||||
if character != '.' {
|
||||
if character != '.' && !character.is_digit(10) {
|
||||
output_sum += num;
|
||||
|
||||
// Part 2
|
||||
|
Reference in New Issue
Block a user