using System.Text.RegularExpressions;
public static void Main()
var re = new Regex("((?:[^" +ch+ "]*" +ch+ "){" + (n-1) + "}[^" +ch+ "]*)" +ch);
var result = re.Replace("I amx nexver axt hoxme on Sxundxaxs", m => m.Groups[1] + "y");
Console.WriteLine(result);