Created
December 5, 2022 22:45
-
-
Save tslater2006/43bdb10d83378521bdec125fa6cad8ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a list to store the containers | |
List<List<string>> containers = new List<List<string>>(); | |
// Split the input string into lines | |
string[] lines = input.Split('\n'); | |
// Loop through each column in the input | |
for (int col = 0; col < 35; col += 4) | |
{ | |
// Create a list to store the entries in the current column | |
List<string> columnEntries = new List<string>(); | |
// Loop through each line in the input | |
for (int row = 0; row < lines.Length; row++) | |
{ | |
// If the line is the container ID row, we are done | |
if (lines[row].Trim().StartsWith("1")) | |
{ | |
break; | |
} | |
// Split the current line into individual characters | |
string[] chars = lines[row].Split(' '); | |
// Ignore empty entries | |
if (chars[col] == "") | |
{ | |
continue; | |
} | |
// Add the character at the current column to the list of entries for the current column | |
columnEntries.Add(chars[col]); | |
} | |
// Add the list of entries for the current column to the list of containers | |
containers.Add(columnEntries); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment