Advertisement
optybg

Untitled

Feb 19th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5.  
  6. namespace AppendLists_Lab2
  7. {
  8.     public class AppendLists_Lab2
  9.     {
  10.         public static void Main()
  11.         {
  12.             var input = Console.ReadLine()
  13.                 .Split('|')
  14.                 .ToList();
  15.  
  16.             List<string> result = new List<string>();
  17.  
  18.             input.Reverse();
  19.  
  20.             for (int i = 0; i < input.Count; i++)
  21.             {
  22.                 List<int> temp = new List<int>(input[i]
  23.                     .Split(' ', StringSplitOptions.RemoveEmptyEntries)
  24.                     .Select(int.Parse)
  25.                     .ToList());
  26.                 result.AddRange(temp);
  27.             }
  28.            
  29.             foreach (var item in result)
  30.             {
  31.                 Console.Write(item + " ");
  32.                 Console.WriteLine();
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement