Advertisement
Guest User

Untitled

a guest
May 30th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5.  
  6. class UseYourChainsBuddy
  7. {
  8.     static void Main()
  9.     {
  10.         string input = Console.ReadLine();
  11.         Match match = Regex.Match(input, @"(?<=<p>).*?(?=<\/p>)", RegexOptions.Singleline);
  12.         string output = string.Empty;
  13.         string temp;
  14.         while (match.Success)
  15.         {
  16.             temp = Regex.Replace(match.Value, @"[^a-z\d\s]", " ");
  17.             temp = Regex.Replace(temp, @"[a-z]", delegate(Match match2)
  18.             {
  19.                 if (match2.Value.CompareTo("m") <= 0)
  20.                 {
  21.                     return ((char)(match2.Value[0] + 13)).ToString();
  22.                 }
  23.                 else
  24.                 {
  25.                     return ((char)(match2.Value[0] - 13)).ToString();
  26.                 }
  27.             });
  28.             temp = Regex.Replace(temp, @"\s{2,}", " ");
  29.             output += temp;
  30.             match = match.NextMatch();
  31.         }
  32.         Console.WriteLine(output);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement