Advertisement
gabi11

Functional Programming - 07. Predicate For Names(2)

May 28th, 2019
131
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.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6.  
  7. namespace Advanced
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int n = int.Parse(Console.ReadLine());
  14.  
  15.             Predicate<string> condition = x => x.Length <= n;
  16.  
  17.             Console.ReadLine()
  18.                 .Split()
  19.                 .Where(x => condition(x))
  20.                 .ToList()
  21.                 .ForEach(Console.WriteLine);
  22.         }
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement