Advertisement
desislava_topuzakova

3. Periodic Table

May 25th, 2022
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _03._Periodic_Table
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             SortedSet<string> elements = new SortedSet<string>();
  11.             int n = int.Parse(Console.ReadLine()); //бр. редове с химични елементи
  12.  
  13.             for (int row = 1; row <= n; row++)
  14.             {
  15.                 string input = Console.ReadLine(); //"Mo O Ce"
  16.                 string[] chElements = input.Split(" "); //["Mo", "O", "Ce"]
  17.                 foreach (string chElement in chElements)
  18.                 {
  19.                     elements.Add(chElement);
  20.                 }
  21.             }
  22.  
  23.             Console.WriteLine(string.Join(" ", elements));
  24.         }
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement