Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace _02._Deciphering
- {
- class Program
- {
- static void Main()
- {
- var firstLine = Console.ReadLine();
- var secondLine = Console.ReadLine().Split();
- var pattern = @"^[d-z{}|#]+$";
- if (Regex.IsMatch(firstLine, pattern))
- {
- var word = Regex.Match(firstLine, pattern).ToString().ToCharArray();
- for (int i = 0; i < word.Length; i++)
- {
- var symbol = (char)(word[i] - 3);
- word[i] = symbol;
- }
- var finalWord = new string(word);
- var result = finalWord.Replace(secondLine[0], secondLine[1]);
- Console.WriteLine(result);
- }
- else
- {
- Console.WriteLine("This is not the book you are looking for.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment