Advertisement
ElviraPetkova

Append Arrays

Feb 23rd, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Append_Arrays
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> whole = Console.ReadLine()
  12.                 .Split("|")
  13.                 .Reverse()
  14.                 .ToList();
  15.  
  16.             List<int> resultList = new List<int>();
  17.  
  18.             for (int i = 0; i < whole.Count; i++)
  19.             {
  20.                 List<int> currentResult = new List<int>(whole[i]
  21.                     .Split(" ", StringSplitOptions.RemoveEmptyEntries).Select(int.Parse)
  22.                     .ToList());
  23.  
  24.                 resultList.AddRange(currentResult);
  25.             }
  26.  
  27.             Console.WriteLine(string.Join(" ", resultList));
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement