Advertisement
Iv555

Untitled

Jan 27th, 2022
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace T07PredicateForNames
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int wordMaxLength = int.Parse(Console.ReadLine());
  11.  
  12.             Predicate<string> shorterWord = w => w.Length <= wordMaxLength;
  13.             Action<string[]> print = w => Console.WriteLine(string.Join("\n", w));
  14.  
  15.             print(Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries)
  16.                 .Where(x => shorterWord(x)).ToArray());
  17.  
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement