fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5.  
  6. public class Test
  7. {
  8.  
  9. public static void Main()
  10. {
  11. string text = @"FName Lname, your system password was changed. If you did not change it or do not know why it was changed, you should contact an administrator immediately.Your new password is Password10
  12.  
  13. If you have any questions, please contact:
  14.  
  15. Solutions Program Office Phone: Email: notifications@cho.com
  16.  
  17. Thank you for using xxxxx";
  18. int indexOfPasswordText = text.IndexOf("Your new password is ");
  19. if (indexOfPasswordText != -1)
  20. {
  21. int passwordStart = indexOfPasswordText + "Your new password is ".Length;
  22. int IndexeOfNextWord = text.IndexOfAny(new[] { '\n', '\r', ' ' }, passwordStart);
  23. if (IndexeOfNextWord == -1) IndexeOfNextWord = text.Length;
  24. string passWord = text.Substring(passwordStart, IndexeOfNextWord - passwordStart);
  25. Console.Write(passWord);
  26. }
  27. }
  28. }
Success #stdin #stdout 0.04s 34776KB
stdin
Standard input is empty
stdout
Password10