Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace PeriodicTable
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Startup
- {
- public static void Main()
- {
- SortedSet<string> chemicalElements = new SortedSet<string>();
- int countOfInputLines = int.Parse(Console.ReadLine());
- for (int currLine = 0; currLine < countOfInputLines; currLine++)
- {
- string[] inputLine = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- inputLine.ForEach(s => chemicalElements.Add(s));
- }
- Console.WriteLine(string.Join(" ", chemicalElements));
- }
- }
- public static class ExtensionMethod
- {
- public static void ForEach(this string[] array, Action<string> actionToExecute)
- {
- foreach (string item in array)
- {
- actionToExecute(item);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement