Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp3
- { class Mentor
- {
- public string Name { get; set; }
- }
- class Program
- {
- public static object Culture { get; private set; }
- static void Main(string[] args)
- {
- var dates = new Dictionary<string, List<DateTime>>();
- var comments = new Dictionary<string, List<string>>();
- var input = Console.ReadLine();
- while (input != "end of dates")
- {
- var info = input.Split(new char[] { ' ', ',' }).ToList();
- string name = info[0];
- if (dates.ContainsKey(name)==false)
- {
- dates.Add(name, new List <DateTime>());
- comments.Add(name, new List <string>());
- }
- for (int i = 1; i < info.Count; i++)
- {
- var currentDate = DateTime.ParseExact(info[i], "dd/MM/yyyy", CultureInfo.InvariantCulture);
- dates[name].Add(currentDate);
- }
- input = Console.ReadLine();
- }
- var commentInfo = Console.ReadLine();
- while (commentInfo != "end of comments")
- {
- var inputComment = commentInfo.Split('-').ToList();
- string name = inputComment[0];
- if (comments.ContainsKey(name))
- {
- comments[name].Add(inputComment[1]);
- }
- commentInfo = Console.ReadLine();
- }
- foreach (var item in comments.OrderBy(x=>x.Key))
- {
- Console.WriteLine($"{item.Key}\nComments:");
- foreach (var comment in item.Value)
- {
- Console.WriteLine($"- {comment}");
- }
- Console.WriteLine($"Dates attended:");
- foreach (var date in dates[item.Key].OrderBy(x=>x.Date))
- {
- Console.WriteLine($"-- {date:dd/MM/yyyy}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment