Advertisement
Guest User

Untitled

a guest
May 10th, 2015
409
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. using System.Text.RegularExpressions;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Palindromes_6
  8. {
  9.     class Palindromes_6
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string words = Console.ReadLine();
  14.             var result = Regex.Matches(words, @"\w+").Cast<Match>()
  15.                         .Select(m => m.Value)
  16.                         .Where(w => String.Join("", w.Reverse()) == w).ToList();
  17.             Console.WriteLine(string.Join(" ", result));        
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement