Advertisement
martinvalchev

Short_Words_Sorted

Feb 15th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Short_Words_Sorted
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {        
  11.             List<string> text = Console.ReadLine().ToLower().Split( new char[] { ' ', '.', ',', ':', ';', '(', ')', '[', ']', '\"', '\'', '\\', '/', '!', '?' },
  12.                 StringSplitOptions.RemoveEmptyEntries).ToList();
  13.             var resultWords = text.Where(x => x.Length < 5).OrderBy(x => x).Distinct().ToList();
  14.            
  15.  
  16.             Console.WriteLine(string.Join(", ",resultWords));
  17.          
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement