// Determines the sum of all "real" rooms from an input public long GetSumOfRealRoomSectorIds(string input) { long result = 0; List <string> lineInputs = input.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); foreach (string lineInput in lineInputs) { EncryptedRoom room = new EncryptedRoom(lineInput); if (room.IsReal()) { result += room.sectorId; } } return(result); }
// Returns the list of actual "real" rooms for futher processing public List <EncryptedRoom> ListRealRooms(string input) { List <EncryptedRoom> result = new List <EncryptedRoom>(); List <string> lineInputs = input.Split(new string[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList <string>(); foreach (string lineInput in lineInputs) { EncryptedRoom room = new EncryptedRoom(lineInput); if (room.IsReal()) { result.Add(room); } } return(result); }