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 stuck_zipper
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> firstList = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- List<int> secondList = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- int minValue = Math.Min(Math.Abs(firstList.Min()), Math.Abs(secondList.Min()));
- int minDigitCount = 0;
- while (minValue > 0)
- {
- minValue = minValue / 10;
- minDigitCount++;
- }
- for (int i = 0; i < firstList.Count; i++)
- {
- int digitCount = 0;
- int currentElement = firstList[i];
- while (currentElement > 0)
- {
- currentElement = currentElement / 10;
- digitCount++;
- }
- if (digitCount > minDigitCount)
- {
- firstList.RemoveAt(i);
- i--;
- }
- }
- for (int i = 0; i < secondList.Count; i++)
- {
- int digitCount = 0;
- int currentElement = secondList[i];
- while (currentElement > 0)
- {
- currentElement = currentElement / 10;
- digitCount++;
- }
- if (digitCount > minDigitCount)
- {
- secondList.RemoveAt(i);
- i--;
- }
- }
- int count = 1;
- for (int i = 0; i < firstList.Count; i++)
- {
- if (i + count <= secondList.Count)
- {
- secondList.Insert(i + count, firstList[i]);
- count++;
- }
- else if (i + count > secondList.Count)
- {
- secondList.Add(firstList[i]);
- }
- }
- Console.WriteLine(string.Join(" ", secondList));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement