Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _1._3.Merging_Lists
- {
- class Program
- {
- static void Main()
- {
- List<int> firstInput = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> secondInput = Console.ReadLine().Split().Select(int.Parse).ToList();
- int counter = 0;
- if (firstInput.Count > secondInput.Count)
- {
- counter = firstInput.Count;
- }
- else
- {
- counter = secondInput.Count;
- }
- List<int> endResult = new List<int>();
- for (int i = 0; i < counter; i++)
- {
- if (i < firstInput.Count)
- {
- endResult.Add(firstInput[i]);
- }
- if (i < secondInput.Count)
- {
- endResult.Add(secondInput[i]);
- }
- }
- Console.WriteLine(string.Join(" ", endResult));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement