elena1234

AppendArrays

Sep 21st, 2020 (edited)
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace Append Arrays
  5. {
  6.     class MainClass
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             List<string> listOfLists = Console.ReadLine().Split('|').ToList();
  11.             List<string> result = new List<string>();
  12.  
  13.             for (int i = listOfLists.Count - 1; i >= 0; i--)
  14.             {
  15.                 var currentList = listOfLists[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
  16.                 foreach (var item in currentList)
  17.                 {
  18.                     result.Add(item);
  19.                 }
  20.  
  21.             }
  22.  
  23.             Console.WriteLine(string.Join(" ",result));
  24.         }
  25.     }
  26. }
  27.  
  28.  
  29.  
Add Comment
Please, Sign In to add comment