using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Zeichenkettenverarbeitung
{
    class MainClass
    {
        static void Main(string[] args)
        {
            Encoding Encoder = new Encoding();
            string klartext = "Dies ist bzw. war ein Klartext.";
            string chiffrat = Encoder.Encode(klartext);
            Console.WriteLine(chiffrat);
            Console.ReadLine();
        }
    }

    class Encoding
    {
        public string Encode(string text)
        {
            StringBuilder builder = new StringBuilder(text,text.Length);
            //Option1
            for (int i = (int)'z'; i >= (int)'a'; i--)
            {
                char alt = (char)i;
                char neu = (char)(i + 2);
                builder.Replace(alt, neu);
            }
            for (int i = (int)'Z'; i >= (int)'A'; i--)
            {
                char alt = (char)i;
                char neu = (char)(i + 2);
                builder.Replace(alt, neu);
            }
            //Option2
            //for (int i = 0; i < builder.Length; i++)
            //    builder[i] = (char)(builder[i] + 2);
            return builder.ToString();
        }
    }
}
