using System; using System.Collections.Generic; using System.Linq; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string enc = "tett rett nete tsvn wnyh este brwn yeez"; var table = Enumerable.Range('d', 'z' - 'd' + 1) .Select(i => (char)i) .Zip(Enumerable.Range('a', 'w' - 'a' + 1).Select(i => (char)i), (f, s) => new KeyValuePair(f, s) ) .Concat(Enumerable.Range('a', 'c' - 'a' + 1) .Select(i => (char)i) .Zip(Enumerable.Range('x', 'z' - 'x' + 1).Select(i => (char)i), (f, s) => new KeyValuePair(f, s) ) ); foreach (var item in table) { enc = enc.Replace(item.Key, item.Value); } Console.WriteLine(enc); } } }