fork(4) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class Program
  5. {
  6. static string AddOne(string s)
  7. {
  8. return Regex.Replace(s, @"\d+", (match) =>
  9. {
  10. long num = 0;
  11. long.TryParse(match.ToString(), out num);
  12. return (num + 1).ToString();
  13. });
  14. }
  15.  
  16. static void Main()
  17. {
  18. Console.WriteLine(AddOne("hello 123!"));
  19. Console.WriteLine(AddOne("bai bai 11"));
  20. }
  21. }
Success #stdin #stdout 0.07s 37280KB
stdin
Standard input is empty
stdout
hello 124!
bai bai 12