fork download
  1. using System;
  2.  
  3. namespace Programs
  4. {
  5. public class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. string str = @"stackoverflow(stack:stackoverflow)overstackflow(over:stackoverflow)";
  10. Console.WriteLine(ExtractString(str));
  11. }
  12.  
  13. static string ExtractString(string s)
  14. {
  15. // You should check for errors in real-world code, omitted for brevity
  16. var startTag = "(";
  17. int startIndex = s.IndexOf(startTag) + startTag.Length;
  18. int endIndex = s.IndexOf(":", startIndex);
  19. return s.Substring(startIndex, endIndex - startIndex);
  20. }
  21. }
  22. }
Success #stdin #stdout 0.05s 33888KB
stdin
Standard input is empty
stdout
stack