skipter icon

List,Arrays - "Track Downloader" banned songs

skipter | PRO | 07/11/17 02:05:46 PM UTC | 0 ⭐ | 297 👁️ | Never ⏰ | []
C# |

1.02 KB

|

None

|

0 👍

/

0 👎

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] bannedSong = Console.ReadLine().Split(' ');
 
            string songs = Console.ReadLine();
            List<string> newPlayList = new List<string>();
             while (songs != "end")
            {
                bool isContained = false;
                for (int cnt = 0; cnt < bannedSong.Length; cnt++)
                {
                    if (songs.Contains(bannedSong[cnt]))
                    {
                        isContained = true;
                    }
                }
                if (!isContained)
                {
                    newPlayList.Add(songs);
                }
                songs = Console.ReadLine();
            }
            newPlayList.Sort();
            Console.WriteLine(string.Join("\r\n", newPlayList));
        }
    }
}

Comments