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;
- //You will receive a list of blacklisted words (on the same line, separated by one space). On the next lines, you will start receiving //a list of filenames (as strings) until you receive the string βendβ. Your task is to add the filenames to a list and sort them. //Ignore the tracks which contain the text in the blacklist.
- namespace Track_downloader
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<string> blackList = Console.ReadLine().Split(' ').ToList();
- List<string> inputList = new List<string>();
- string input = string.Empty;
- while (input != "end")
- {
- input = Console.ReadLine();
- bool notBlackListed = true;
- foreach (string word in blackList)
- {
- if (input.Contains(word) || input.Contains("end"))
- {
- notBlackListed = false;
- break;
- }
- }
- if (notBlackListed)
- {
- inputList.Add(input);
- }
- }
- inputList.Sort();
- for (int i = 0; i < inputList.Count; i++)
- {
- Console.WriteLine(inputList[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement