Guest User

Untitled

a guest
Feb 15th, 2017
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. namespace _04
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6.  
  7. public class Program
  8. {
  9. public static void Main()
  10. {
  11. var input = Console.ReadLine().Split(new char[] { ' ', '.', ',', '?', '!' }, StringSplitOptions.RemoveEmptyEntries);
  12.  
  13. var list = new List<string>();
  14.  
  15. foreach (var word in input)
  16. {
  17. if (word.SequenceEqual(word.Reverse()))
  18. {
  19. list.Add(word);
  20. }
  21. }
  22.  
  23. Console.WriteLine(string.Join(", ", list.OrderBy(a => a).Distinct()));
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment