Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace _4._Songs
- {
- class Song
- {
- public string TypeList { get; set; }
- public string Name { get; set; }
- public string Time { get; set; }
- }
- class Program
- {
- static void Main()
- {
- int numSongs = int.Parse(Console.ReadLine());
- List<Song> songs = new List<Song>();
- for (int i=0; i< numSongs; i++)
- {
- string[] data = Console.ReadLine().Split("_");
- Song song = new Song();
- song.TypeList = data[0];
- song.Name = data[1];
- song.Time = data[2];
- songs.Add(song);
- }
- string type = Console.ReadLine();
- if (type == "all")
- {
- foreach (var item in songs)
- {
- Console.WriteLine(item.Name);
- }
- }
- else
- {
- foreach (var item in songs)
- {
- if (item.TypeList == type) Console.WriteLine(item.Name);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement