fork download
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. public class Test
  6. {
  7. static string RemoveMatchingBraces(string s)
  8. {
  9. string orig = "";
  10. Regex rgx = new Regex("{[^{]*?}");
  11. while (!orig.Equals(s))
  12. {
  13. orig = s;
  14. s = rgx.Replace(orig, "");
  15. }
  16. return s;
  17. }
  18.  
  19. public static void Main()
  20. {
  21. Console.WriteLine(RemoveMatchingBraces("}}AB{CDE{FG}H{IJ}K}LMN{OP}QRS{{"));
  22. }
  23. }
Success #stdin #stdout 0.1s 24720KB
stdin
Standard input is empty
stdout
}}ABLMNQRS{{