Guest User

Untitled

a guest
Oct 16th, 2016
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. //. , : ; ( ) [ ] " ' \ / ! ? (space).
  14. var arrayOfWords = Console.ReadLine()
  15. .ToLower()
  16. .Split(new char[] { '.', ',', ':', ';', '(', ')', '[', ']', '"', '\'', '\\', '/', '!', '?', ' ' },StringSplitOptions.RemoveEmptyEntries)
  17. .ToArray();
  18.  
  19. var smallWords = new List<string>();
  20.  
  21. foreach (var word in arrayOfWords)
  22. {
  23. if (word.Length < 5)
  24. {
  25. smallWords.Add(word);
  26. }
  27. }
  28. var result = smallWords
  29. .OrderBy(w => w)
  30. .Distinct();
  31.  
  32. Console.WriteLine(string.Join(", ", result));
  33.  
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment