kirililchev3

Append Lists

Jun 9th, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace sad
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             List <string> input = Console.ReadLine().Split('|').ToList();
  11.             List<string> result = new List<string>();
  12.             input.Reverse();
  13.             for (int i = 0; i < input.Count; i++)
  14.             {
  15.                 string text = input[i];
  16.                string[] splited = text.Split(new char[] {' '},
  17.                    StringSplitOptions.RemoveEmptyEntries);
  18.  
  19.                 string merged = string.Join(" ", splited);
  20.                 result.Add(merged);
  21.             }
  22.             Console.WriteLine(string.Join(" ", result));
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment