Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 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 Use_Your_Chains_Buddy_RegEx
  9. {
  10. class Program
  11. {
  12.  
  13. static void Main(string[] args)
  14. {
  15.  
  16. var pattern = @"<p>(.+?[\n]*)<\/p>";
  17.  
  18. var input = Console.ReadLine();
  19.  
  20. Regex regex = new Regex(pattern);
  21.  
  22. var matches = regex.Matches(input);
  23.  
  24. Regex rep = new Regex(@"[\W]+");
  25. Regex tag = new Regex(@"(<p>)|(<\/p>)");
  26.  
  27. var result = string.Empty;
  28.  
  29. foreach (Match item in matches)
  30. {
  31. result += item.Value.ToString();
  32. }
  33. result = tag.Replace(result, "");
  34. result = rep.Replace(result, " ");
  35.  
  36. var newResult = string.Empty;
  37.  
  38. for (int i = 0; i < result.Length; i++)
  39. {
  40. if (char.IsLetter(result[i]))
  41. {
  42. if (result[i] <= 109)
  43. {
  44. newResult += (char)(result[i] + 12 + 1);
  45. }
  46. else
  47. {
  48. newResult += (char)(result[i] - 12 - 1);
  49. }
  50. }
  51. else
  52. {
  53. newResult += result[i];
  54. }
  55. }
  56.  
  57. Console.WriteLine(newResult);
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement