Advertisement
didatzi

P02_appendetLists

Jun 14th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace P02_AppendLists
  8. {
  9.     class P02_AppendLists
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var nums = Console.ReadLine().Split('|').ToList();
  14.             nums.Reverse();
  15.             var textJoin = string.Join("|", nums);
  16.             var resultList = textJoin.Split('|', ' ').ToList();
  17.             var finalList = new List<string>();
  18.             for (int i = 0; i < resultList.Count; i++)
  19.             {
  20.                 if (resultList[i] != string.Empty)
  21.                 {
  22.                     finalList.Add(resultList[i]);
  23.                 }
  24.             }
  25.             Console.WriteLine(string.Join(" ", finalList));
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement