fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Solution
  5. {
  6. public static void Main(String[] args)
  7. {
  8. string input = "where dog is and cats are and bird is bigger than a mouse";
  9. string pattern = "(?:where|and)";
  10. string[] substrings = Regex.Split(input, pattern);
  11. foreach (string match in substrings)
  12. {
  13. Console.WriteLine("'{0}'", match);
  14. }
  15. }
  16. }
Success #stdin #stdout 0.02s 134720KB
stdin
Standard input is empty
stdout
''
' dog is '
' cats are '
' bird is bigger than a mouse'