using System;
namespace HJ29
{
/// <summary>字符串加解密</summary>
internal class Program
{
static void Main(string[] args)
{
var strToEncryption = Console.ReadLine();
var strToDecryption = Console.ReadLine();
Console.WriteLine(StringEncryption(strToEncryption));
Console.WriteLine(StringDecryption(strToDecryption));
}
static string StringEncryption(string s)
{
char[] chars = s.ToCharArray();
for (int i = 0; i < chars.Length; i++)
{
char c = chars[i];
if (char.IsLetter(c))
{
if (c == 'Z')
{
chars[i] = 'a';
continue;
}
if (c == 'z')
{
chars[i] = 'A';
continue;
}
if (char.IsLower(c))
{
chars[i] = (char)(char.ToUpper(c) + 1);
}
else
{
chars[i] = (char)(char.ToLower(c) + 1);
}
}
else if (char.IsDigit(c))
{
if (c == '9')
{
chars[i] = '0';
}
else
{
chars[i] = (char)(c + 1);
}
}
}
return new string(chars);
}
static string StringDecryption(string s)
{
char[] chars = s.ToCharArray();
for (int i = 0; i < chars.Length; i++)
{
char c = chars[i];
if (char.IsLetter(c))
{
if (c == 'A')
{
chars[i] = 'z';
continue;
}
if (c == 'a')
{
chars[i] = 'Z';
continue;
}
if (char.IsLower(c))
{
chars[i] = (char)(char.ToUpper(c) - 1);
}
else
{
chars[i] = (char)(char.ToLower(c) - 1);
}
}
else if (char.IsDigit(c))
{
if (c == '0')
{
chars[i] = '9';
}
else
{
chars[i] = (char)(c - 1);
}
}
}
return new string(chars);
}
}
}

京公网安备 11010502036488号