added trim_end because of windows
This commit is contained in:
@@ -14,7 +14,7 @@ pub fn day01a() -> u64 {
|
|||||||
|
|
||||||
// parse file
|
// parse file
|
||||||
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
||||||
let mut split = line.split(" ");
|
let mut split = line.trim_end().split(" ");
|
||||||
list_a[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
list_a[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
||||||
list_b[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
list_b[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ pub fn day01b() -> u64 {
|
|||||||
|
|
||||||
// parse file
|
// parse file
|
||||||
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
||||||
let mut split = line.split(" ");
|
let mut split = line.trim_end().split(" ");
|
||||||
list_a[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
list_a[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
||||||
list_b[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
list_b[line_nr] = split.next().unwrap().parse::<i32>().unwrap();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub fn day02a() -> u64 {
|
|||||||
let mut nr_or_correct_reports: u64 = 0;
|
let mut nr_or_correct_reports: u64 = 0;
|
||||||
// iterate over all reports
|
// iterate over all reports
|
||||||
file_content.split("\n").for_each(|report| {
|
file_content.split("\n").for_each(|report| {
|
||||||
let levels: Vec<i32> = report.split(" ").map(|level| level.parse::<i32>().unwrap()).collect();
|
let levels: Vec<i32> = report.trim_end().split(" ").map(|level| level.parse::<i32>().unwrap()).collect();
|
||||||
let mut trend: i32 = 0;
|
let mut trend: i32 = 0;
|
||||||
let mut safe: bool = true;
|
let mut safe: bool = true;
|
||||||
// iterate over all levels and ty to find a trend
|
// iterate over all levels and ty to find a trend
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ pub fn day02b() -> u64 {
|
|||||||
let mut nr_or_correct_reports: u64 = 0;
|
let mut nr_or_correct_reports: u64 = 0;
|
||||||
// iterate over all reports
|
// iterate over all reports
|
||||||
file_content.split("\n").for_each(|report| {
|
file_content.split("\n").for_each(|report| {
|
||||||
let levels: Vec<i32> = report.split(" ").map(|level| level.parse::<i32>().unwrap()).collect();
|
let levels: Vec<i32> = report.trim_end().split(" ").map(|level| level.parse::<i32>().unwrap()).collect();
|
||||||
let mut trend: i32 = 0;
|
let mut trend: i32 = 0;
|
||||||
let mut safe: i32 = 2;
|
let mut safe: i32 = 2;
|
||||||
// iterate over all levels and ty to find a trend
|
// iterate over all levels and ty to find a trend
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub fn day04a() -> u64 {
|
|||||||
// create n*n matrix from input
|
// create n*n matrix from input
|
||||||
let mut matrix: [[char; 140]; 140] = [[' '; 140]; 140];
|
let mut matrix: [[char; 140]; 140] = [[' '; 140]; 140];
|
||||||
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
||||||
line.chars().enumerate().for_each(|(col_nr, ch)| {
|
line.trim_end().chars().enumerate().for_each(|(col_nr, ch)| {
|
||||||
matrix[line_nr][col_nr] = ch;
|
matrix[line_nr][col_nr] = ch;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub fn day04b() -> u64 {
|
|||||||
// create n*n matrix from input
|
// create n*n matrix from input
|
||||||
let mut matrix: [[char; 140]; 140] = [[' '; 140]; 140];
|
let mut matrix: [[char; 140]; 140] = [[' '; 140]; 140];
|
||||||
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
file_content.split("\n").enumerate().for_each(|(line_nr, line)| {
|
||||||
line.chars().enumerate().for_each(|(col_nr, ch)| {
|
line.trim_end().chars().enumerate().for_each(|(col_nr, ch)| {
|
||||||
matrix[line_nr][col_nr] = ch;
|
matrix[line_nr][col_nr] = ch;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user