Advertisement
Guest User

AppendArrays

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace _08AnonymousThreat
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var stringList = Console.ReadLine()
  12.                 .Split('|', StringSplitOptions.RemoveEmptyEntries)
  13.                 .Reverse()
  14.                 .ToList();
  15.  
  16.             var finalList = new List<int>();
  17.  
  18.             foreach (var number in stringList)
  19.             {
  20.                 finalList.AddRange(number.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
  21.                     .Select(int.Parse)
  22.                     .ToList()
  23.                     );
  24.             }
  25.  
  26.             Console.Write(string.Join(" ", finalList));
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement