Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.RegularExpressions;
- public class UseYourChainsBuddy
- {
- public static void Main()
- {
- Console.SetIn(new StreamReader(Console.OpenStandardInput(8192)));
- var input = Console.ReadLine();
- var pattern = @"<p>(.*?)<\/p>";
- var regex = new Regex(pattern);
- var matches = regex.Matches(input);
- var output = new List<string>();
- foreach (Match match in matches)
- {
- var textToConvert = match.Groups[1].Value;
- textToConvert = Regex.Replace(textToConvert,@"[^a-z0-9]+", " ");
- var textArr = textToConvert.Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries);
- for (int i = 0; i < textArr.Length; i++)
- {
- var newWord = new Queue<char>();
- var word = textArr[i];
- for (int y = 0; y < word.Length; y++)
- {
- if ((int)word[y] >= 97 && (int)word[y] <= 109)
- {
- var ch = (char)(((int)word[y]) + 13);
- newWord.Enqueue(ch);
- }
- else if ((int)word[y] >= 110 && (int)word[y] <= 122)
- {
- var ch = (char)(((int)word[y]) - 13);
- newWord.Enqueue(ch);
- }
- else
- {
- newWord.Enqueue(word[y]);
- }
- }
- output.Add(string.Join("", newWord));
- }
- }
- Console.WriteLine(string.Join(" ",output));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment