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.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.IO;
- namespace P8_UseYourChains
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));
- string input = Console.ReadLine();
- string pattern = @"(?<=<p>)(.+?)(?=<\/p>)";
- StringBuilder wholeText = new StringBuilder();
- MatchCollection matches = Regex.Matches(input, pattern);
- foreach (Match match in matches)
- {
- wholeText.Append(match.ToString() + " ");
- }
- string replace = @"[^a-z0-9]";
- string replaced = wholeText.ToString();
- replaced=Regex.Replace(replaced, replace, " ");
- string removeSpaces = @"\s{2,}";
- replaced = Regex.Replace(replaced, removeSpaces, " ");
- char[] arr = replaced.ToCharArray();
- for (int i = 0; i < arr.Length; i++)
- {
- if(arr[i] >= 'a' && arr[i] <= 'm')
- {
- Console.Write((char)(arr[i] + 13));
- }
- else if (arr[i] >= 'n' && arr[i] <= 'z')
- {
- Console.Write((char)(arr[i] - 13));
- }
- else
- {
- Console.Write(arr[i]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement