Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace fundamental14
- {
- class MainClass
- {
- public static void Main()
- {
- List<int> number = Console.ReadLine().Split().Select(int.Parse).ToList();
- for (int i = 0; i < number.Count; i++)
- {
- if (number[i] < 0)
- {
- number.RemoveAt(i);
- i -= 1;
- }
- }
- number.Reverse();
- if (number.Count == 0)
- {
- Console.WriteLine("empty");
- }
- else
- {
- Console.WriteLine(string.Join(" ", number));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment