Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Collections.Generic;
- using System.Text;
- namespace Deciphering_FinalExam_06._04._2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- char[] input = Console.ReadLine().ToCharArray();
- string[] secLine = Console.ReadLine().Split(" ").ToArray();
- string previous = secLine[0];
- string next = secLine[1];
- StringBuilder descrypt = new StringBuilder();
- for (int i = 0; i < input.Length; i++)
- {
- char symb = input[i];
- if ((symb >= 'd' && symb <= 'z') || symb == '{' || symb == '}' || symb == '|' || symb == '#' )
- {
- int current = (int)symb - 3;
- symb = (char)(current);
- descrypt.Append(symb);
- }
- else
- {
- Console.WriteLine("This is not the book you are looking for.");
- break;
- }
- }
- string wordForDesc = descrypt.ToString();
- if (wordForDesc.Contains(previous))
- {
- descrypt.Replace(previous, next);
- Console.Write(string.Join(" ", descrypt));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement