Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- class Program
- {
- static void Main(string[] args)
- {
- string[] songs = Console.ReadLine().Split(", ");
- Queue<string> songQueue = new Queue<string>(songs);
- while (songQueue.Count > 0)
- {
- string[] command = Console.ReadLine().Split();
- if (command[0] == "Play")
- {
- songQueue.Dequeue();
- }
- else if (command[0] == "Add")
- {
- string song = string.Join(" ",command, 1, command.Length -1);
- if (songQueue.Contains(song))
- {
- Console.WriteLine($"{song} is already contained!");
- }
- else
- {
- songQueue.Enqueue(song);
- }
- }
- else if (command[0] == "Show")
- {
- Console.WriteLine(string.Join(", ", songQueue));
- }
- }
- Console.WriteLine("No more songs!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement