fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. string text = "this is my story, if it's interesting somemail@domain.com so thanks for your time";
  11. if(text.Contains('@'))
  12. {
  13. string[] words = text.Split();
  14. string[] emails = words.Where(word => word.Contains('@')).ToArray();
  15. text = string.Join(" ", words.Where(word => !word.Contains('@')).ToArray());
  16. Console.WriteLine(text);
  17. foreach(var email in emails)
  18. Console.WriteLine(email);
  19. }
  20.  
  21. }
  22. }
Success #stdin #stdout 0.04s 34024KB
stdin
Standard input is empty
stdout
this is my story, if it's interesting so thanks for your time
somemail@domain.com