static void Main(string[] args) { List <Learner> result = new List <Learner>(); string inputData = Console.ReadLine(); string[] input = inputData.Split(' '); while (!(inputData.Equals("end of dates"))) { string name = input[0]; Learner noob = new Learner(); noob.Name = name; if (input.Length <= 1) { inputData = Console.ReadLine(); input = inputData.Split(' '); result.Add(noob); continue; } string[] datesInfo = input[1].Split(','); noob.Name = name; for (int i = 0; i < datesInfo.Length; i++) { DateTime date = DateTime.ParseExact(datesInfo[i], "dd/MM/yyyy", CultureInfo.InvariantCulture); if (ContainsLearner(result, noob) != -1) { noob = result[ContainsLearner(result, noob)]; } else { result.Add(noob); } noob.Dates.Add(date); } inputData = Console.ReadLine(); input = inputData.Split(' '); } string comments = Console.ReadLine(); string[] commentsSection = comments.Split('-'); while (!(comments.Equals("end of comments"))) { string name = commentsSection[0]; Learner noob = new Learner(); if (commentsSection.Length <= 1) { comments = Console.ReadLine(); commentsSection = comments.Split('-'); continue; } noob.Name = name; if (ContainsLearner(result, noob) != -1) { noob = result[ContainsLearner(result, noob)]; } noob.Comments.Add(commentsSection[1]); comments = Console.ReadLine(); commentsSection = comments.Split('-'); } result = result.OrderBy(x => x.Name).ToList(); for (int i = 0; i < result.Count; i++) { PrintComments(result[i]); PrintDates(result[i]); } }