// See https://aka.ms/new-console-template for more information using System.Text; using PoyoLang.Dictionary; var dictionary = new Dictionary(); var text = "Lorem ipsum dolor sit amet"; var output = new StringBuilder(text.Length); var span = text.AsSpan(); NextLetter(ref span, output); Console.Write(output.ToString()); void NextLetter(ref ReadOnlySpan text, StringBuilder output) { if (text.Length > 0) { var isCaps = char.IsUpper(text[0]); switch (text[0]) { case 'a' or 'A': if (text.Length > 1) { switch (text[1]) { case 'm': text = text[2..]; output.Append(isCaps ? "Payo" : "payo"); return; } } text = text[1..]; output.Append(isCaps ? "Piyo" : "piyo"); return; case 'b' or 'B': text = text[1..]; output.Append(isCaps ? "Pïyo" : "pïyo"); return; } text = text[1..]; output.Append(text[0]); } }