static void Main(string[] args) { List <string> models = new List <string>(); List <string> robotIds = new List <string>(); List <string> names = new List <string>(); List <string> citizenIds = new List <string>(); List <int> ages = new List <int>(); string[] comand = Console.ReadLine().Split(); while (comand[0] != "End") { if (comand.Length == 2) { models.Add(comand[0]); robotIds.Add(comand[1]); } else { names.Add(comand[0]); ages.Add(int.Parse(comand[1])); citizenIds.Add(comand[2]); } comand = Console.ReadLine().Split(); } string fakeIdSnippet = Console.ReadLine(); Citizens citizens = new Citizens(citizenIds, names, ages); Robots robots = new Robots(robotIds, models); Console.WriteLine(string.Join(" ", citizens.IdentifyCriminals(fakeIdSnippet))); Console.WriteLine(string.Join(" ", robots.IdentifyCriminals(fakeIdSnippet))); }
public void Run() { string[] inputArgs = Console.ReadLine().Split(); while (inputArgs[0] != "End") { if (inputArgs.Length == 3) { string name = inputArgs[0]; int age = int.Parse(inputArgs[1]); string id = inputArgs[2]; Citizens citizens = new Citizens(id, name, age); identifications.Add(citizens); } else if (inputArgs.Length == 2) { string model = inputArgs[0]; string id = inputArgs[1]; Robots robots = new Robots(id, model); identifications.Add(robots); } inputArgs = Console.ReadLine().Split(); } string digitsFakeId = Console.ReadLine(); foreach (var id in identifications.Where(x => x.Id.EndsWith(digitsFakeId))) { Console.WriteLine(id.Id); } }