Advertisement
obedmarsh

03. Short Words Sorted

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