using
System;
using
System.Collections.Generic;
class
AtbashCipher {
static
Dictionary<
char
,
char
> lookup_table
=
new
Dictionary<
char
,
char
>{
{
'A'
,
'Z'
}, {
'B'
,
'Y'
}, {
'C'
,
'X'
},
{
'D'
,
'W'
}, {
'E'
,
'V'
}, {
'F'
,
'U'
},
{
'G'
,
'T'
}, {
'H'
,
'S'
}, {
'I'
,
'R'
},
{
'J'
,
'Q'
}, {
'K'
,
'P'
}, {
'L'
,
'O'
},
{
'M'
,
'N'
}, {
'N'
,
'M'
}, {
'O'
,
'L'
},
{
'P'
,
'K'
}, {
'Q'
,
'J'
}, {
'R'
,
'I'
},
{
'S'
,
'H'
}, {
'T'
,
'G'
}, {
'U'
,
'F'
},
{
'V'
,
'E'
}, {
'W'
,
'D'
}, {
'X'
,
'C'
},
{
'Y'
,
'B'
}, {
'Z'
,
'A'
}
};
static
string
Atbash(
string
message)
{
string
cipher =
""
;
foreach
(
char
letter
in
message)
{
if
(letter !=
' '
) {
cipher
+= lookup_table[Char.ToUpper(letter)];
}
else
{
cipher +=
' '
;
}
}
return
cipher;
}
static
void
Main()
{
string
message =
"GEEKS FOR GEEKS"
;
Console.WriteLine(Atbash(message));
message =
"TVVPH ULI TVVPH"
;
Console.WriteLine(Atbash(message));
}
}