Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Remove_Negatives_and_Reverse
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine()
- .Split(" ", StringSplitOptions.RemoveEmptyEntries)
- .Select(int.Parse)
- .Where(n => n >= 0)
- .Reverse()
- .ToList();
- if (numbers.Count >0)
- {
- Console.WriteLine(String.Join(" ", numbers));
- }
- else
- {
- Console.WriteLine("empty");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement