Advertisement
Guest User

AppendArrays

a guest
Oct 23rd, 2019
118
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 AppendArrays
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             List<string> numbers = Console.ReadLine()
  12.              .Split('|')
  13.              .Reverse()
  14.              .ToList();
  15.             List<int> newNumbers = new List<int>();
  16.  
  17.            foreach (string element in numbers)
  18.             {
  19.                 newNumbers.AddRange(element.Split(" ", StringSplitOptions.RemoveEmptyEntries)
  20.                 .Select(int.Parse)
  21.                 .ToList()
  22.                 );
  23.             }
  24.             Console.Write(string.Join(' ', newNumbers));
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement