Advertisement
-Annie-

PeriodicTable

May 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1. namespace PeriodicTable
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.  
  6.     public class PeriodicTable
  7.     {
  8.         public static void Main()
  9.         {
  10.             int n = int.Parse(Console.ReadLine());
  11.             SortedSet<string> chemicalsSet = new SortedSet<string>();
  12.  
  13.             for (int i = 0; i < n; i++)
  14.             {
  15.                 string[] chemicals = Console.ReadLine().Split(' ');
  16.  
  17.                 foreach (var item in chemicals)
  18.                 {
  19.                     chemicalsSet.Add(item);
  20.                 }
  21.             }
  22.  
  23.  
  24.             foreach (var item in chemicalsSet)
  25.             {
  26.                 Console.Write(item + " ");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement