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 = "13+7-4/2+12";
  10. string[] tokens = Regex.Matches(s, @"\d+|[-+/*()]").Cast<Match>().Select(m => m.Value).ToArray();
  11. Console.WriteLine(string.Join("\n", tokens));
  12. }
  13. }
Success #stdin #stdout 0.06s 22324KB
stdin
Standard input is empty
stdout
13
+
7
-
4
/
2
+
12