Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace Use_Your_Chains_Buddy_RegEx
- {
- class Program
- {
- static void Main(string[] args)
- {
- var pattern = @"<p>(.+?[\n]*)<\/p>";
- var input = Console.ReadLine();
- Regex regex = new Regex(pattern);
- var matches = regex.Matches(input);
- Regex rep = new Regex(@"[\W]+");
- Regex tag = new Regex(@"(<p>)|(<\/p>)");
- var result = string.Empty;
- foreach (Match item in matches)
- {
- result += item.Value.ToString();
- }
- result = tag.Replace(result, "");
- result = rep.Replace(result, " ");
- var newResult = string.Empty;
- for (int i = 0; i < result.Length; i++)
- {
- if (char.IsLetter(result[i]))
- {
- if (result[i] <= 109)
- {
- newResult += (char)(result[i] + 12 + 1);
- }
- else
- {
- newResult += (char)(result[i] - 12 - 1);
- }
- }
- else
- {
- newResult += result[i];
- }
- }
- Console.WriteLine(newResult);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement