Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace UseYourChainsBuddy
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));
- // Decrypted manual
- List<string> manual = new List<string>();
- string input = Console.ReadLine();
- // Find text inside <p> tags
- string tagPattern = @"<p>(.+?)<\/p>";
- MatchCollection inputMatches = Regex.Matches(input, tagPattern);
- foreach (Match match in inputMatches)
- {
- string rawText = match.Groups[1].Value;
- // Leave only small letters and digits - the rest replace with a space
- string alphanumPattern = @"[^a-z0-9]+";
- rawText = Regex.Replace(rawText, alphanumPattern, " ");
- // Do a ROT13
- StringBuilder rot13Text = new StringBuilder(rawText);
- for (int i = 0; i < rot13Text.Length; i++)
- {
- char letter = rot13Text[i];
- if (letter >= 'a' && letter <= 'm')
- {
- rot13Text[i] = (char)(letter + 13);
- }
- else if ( letter > 'm' && letter <= 'z' )
- {
- rot13Text[i] = (char)(letter - 13);
- }
- }
- // Add decrypted text to manual
- manual.Add(rot13Text.ToString().Trim());
- }
- Console.WriteLine(string.Join(" ", manual));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement