Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Treasure_Hunt
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<string> items = Console.ReadLine()
- .Split("|", StringSplitOptions.RemoveEmptyEntries)
- .ToList();
- while (true)
- {
- string line = Console.ReadLine();
- string[] tokens = line.Split();
- if (line == "Yohoho!")
- {
- break;
- }
- else
- {
- if (tokens[0] == "Loot")
- {
- for (int i = 1; i < tokens.Length; i++)
- {
- if (items.Contains(tokens[i]))
- {
- break;
- }
- else
- {
- items.Insert(0, tokens[i]);
- }
- }
- }
- }
- }
- foreach (string item in items)
- {
- Console.Write(item + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement