Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace E07.PredicateForNames
- {
- public class StartUp
- {
- public static void Main()
- {
- int charCount = int.Parse(Console.ReadLine());
- Func<string, bool> myFunc = x => x.Length <= charCount;
- var names = Console.ReadLine()
- .Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries)
- .OrderBy(n => n.Length)
- .Where(n=>myFunc(n))
- .ToList();
- names.ForEach(Console.WriteLine);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment