Advertisement
martinvalchev

Use_Your_Chains__Buddy

Feb 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Use_Your_Chains__Buddy
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.  
  16.            
  17.             Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));
  18.             string html = Console.ReadLine();
  19.  
  20.            
  21.             string pattern = @"<p>(.[^\/]+)<\/p>";
  22.             string regex = @"[^a-z0-9]+";
  23.  
  24.            
  25.             Regex words = new Regex(pattern);
  26.             MatchCollection matches = words.Matches(html);
  27.             string encrypted = "";
  28.             for (int i = 0; i < matches.Count; i++)
  29.             {
  30.                 string temp = matches[i].Groups[1].Value;
  31.                 encrypted += Regex.Replace(temp, regex, word => " ");
  32.             }
  33.  
  34.          
  35.             string manual = "";
  36.             for (int i = 0; i < encrypted.Length; i++)
  37.             {
  38.                 if (encrypted[i] >= 'a' && encrypted[i] <= 'm')
  39.                 {
  40.                     manual += (char)(encrypted[i] + 13);
  41.                  
  42.                 }
  43.                 else if (encrypted[i] >= 'n' && encrypted[i] <= 'z')
  44.                 {
  45.                     manual += (char)(encrypted[i] - 13);
  46.                 }
  47.                 else if (Char.IsDigit(encrypted[i]) || Char.IsWhiteSpace(encrypted[i]))
  48.                 {
  49.                     manual += encrypted[i];
  50.                 }
  51.             }
  52.             Console.WriteLine(manual);
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement