fork(4) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static void Main()
  7. {
  8. string input = ". . . . First . . Second . . . . . Third . . .";
  9. string output = Regex.Replace(input, @"((\s)?(\S)(?(2)|\s))\1+\s?", "$3");
  10. Console.WriteLine(output);
  11. }
  12. }
Success #stdin #stdout 0.07s 38336KB
stdin
Standard input is empty
stdout
.First.Second.Third.