Advertisement
ge_or_gi

Untitled

Jan 31st, 2013
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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. using System.Text.RegularExpressions;
  7.  
  8. namespace Polindromes
  9. {
  10. class Polindromes
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15. string textStr = @"Nice blue sky. No exe flying in the sky. ABBA will not come in Bulgaria.
  16. I don`t know what is lamal, maybe I will find some day. mouseesuom";
  17.  
  18. foreach (var word in Regex.Matches(textStr, @"\w*"))
  19. {
  20. string wordStr = Convert.ToString(word);
  21.  
  22. for (int i = 0; i < (wordStr.Length/2); i++)
  23. {
  24.  
  25. if (wordStr[i] != wordStr[wordStr.Length-i-1])
  26. {
  27. break;
  28. }
  29. else
  30. {
  31. if (i == (wordStr.Length/2)-1)
  32. {
  33. Console.WriteLine(wordStr);
  34. }
  35. }
  36. }
  37.  
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement