/
Program.cs
35 lines (32 loc) · 998 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
namespace _02._Deciphering
{
using System.Text.RegularExpressions;
class Program
{
static void Main(string[] args)
{
string input = Console.ReadLine();
var replaceString = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
Regex regex = new Regex(@"[d-z#|{}]+");
string result = "";
var match = regex.Match(input);
if (input.Length!=match.Length)
{
Console.WriteLine("This is not the book you are looking for.");
}
else
{
for (int i = 0; i < match.Length; i++)
{
result+=((char)(input[i] - 3));
}
}
while (result.Contains(replaceString[0]))
{
result = result.Replace(replaceString[0], replaceString[1]);
}
Console.WriteLine(result);
}
}
}