Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _10.Exercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- var result = new List<Exercise>();
- while (input != "go go go")
- {
- Exercise currExercise = ReadExercise(input);
- result.Add(currExercise);
- input = Console.ReadLine();
- }
- int counter = 1;
- foreach (var item in result)
- {
- Console.WriteLine($"Exercises: {item.Topic}");
- Console.WriteLine($"Problems for exercises and homework for the \"{item.CourseName}\" course @ SoftUni.");
- Console.WriteLine($"Check your solutions here: {item.JudgeContestLink}");
- foreach (var prob in item.Problems)
- {
- Console.WriteLine($"{counter}. {prob}");
- counter++;
- }
- }
- }
- private static Exercise ReadExercise(string input)
- {
- string[] tokens = input.Split(new string[] { " -> " }, StringSplitOptions.RemoveEmptyEntries).ToArray();
- string topic = tokens[0];
- string courseName = tokens[1];
- string link = tokens[2];
- List<string> problems = tokens[3].Split(new string[] { ", " },
- StringSplitOptions.RemoveEmptyEntries).ToList();
- return new Exercise
- {
- Topic = topic,
- CourseName = courseName,
- JudgeContestLink = link,
- Problems = problems
- };
- }
- }
- class Exercise
- {
- public string Topic { get; set; }
- public string CourseName { get; set; }
- public string JudgeContestLink { get; set; }
- public List<string> Problems { get; set; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement