fork download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var s = "XYYXYX";
  10. var res = Regex.Replace(s, @"X(Y+)X", m => string.Format("X{0}X",m.Groups[1].Value.Replace("Y", "Z")));
  11. Console.WriteLine(res);
  12. }
  13. }
Success #stdin #stdout 0.13s 24544KB
stdin
Standard input is empty
stdout
XZZXYX