Advertisement
kaloyanTry

AppendedLists

Aug 14th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _03AppendedLists
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> lists = Console.ReadLine().Split('|').ToList();
  12.             List<string> listResult = new List<string>();
  13.  
  14.             for (int i = lists.Count - 1; i >= 0; i--)
  15.             {
  16.                 string[] currList = lists[i].Split(' ');
  17.                 foreach (var item in currList)
  18.                 {
  19.                     if (item != " ") listResult.Add(item);
  20.                 }
  21.                 Console.WriteLine(String.Join(" ", listResult));
  22.             }
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement