Advertisement
Prohause

Use your chain Budy

Feb 25th, 2018
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace Problem08
  6. {
  7. internal class Program
  8. {
  9. private static void Main(string[] args)
  10. {
  11. Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));
  12. const string pattern = @"<p>(.*?)<\/p>";
  13.  
  14. var input = Console.ReadLine();
  15.  
  16. var match = Regex.Match(input, pattern);
  17.  
  18. while (match.Success)
  19. {
  20. var currentString = match.Groups[1].Value;
  21. currentString = Regex.Replace(currentString, @"[^a-z0-9]", " ");
  22. currentString = Regex.Replace(currentString, @"\s+", " ");
  23.  
  24. foreach (var t in currentString)
  25. {
  26. if (char.IsLetter(t))
  27. {
  28. char newChar;
  29. if (t <= 109)
  30. {
  31. newChar = (char)(t + 13);
  32. }
  33. else
  34. {
  35. newChar = (char)(t - 13);
  36. }
  37. Console.Write(newChar);
  38. }
  39. else
  40. {
  41. Console.Write(t);
  42. }
  43. }
  44.  
  45. match = match.NextMatch();
  46. }
  47.  
  48. Console.WriteLine();
  49. }
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement