Advertisement
Stan0033

Untitled

Aug 1st, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. namespace apps
  8. {
  9. class Program
  10. {
  11. static string Get() { return Console.ReadLine(); }
  12.  
  13.  
  14.  
  15.  
  16. static void Main()
  17. {
  18. // ticket
  19. string raw = Get();
  20. string pattern = @"[A-Za-z]*(?<money>[$|@|#|^]{6,10})[A-Za-z]*[$|@|#|^]{6,10}[A-Za-z]*";
  21. //-------------------------------------------------------------------------------------------
  22. //-------------------------------------------------------------------------------------------
  23.  
  24. //-------------------------------------------------------------------------------------------
  25. //-------------------------------------------------------------------------------------------
  26. MatchCollection matches = Regex.Matches(raw, pattern);
  27. if (matches.Count == 0) { Console.WriteLine("ticket \"validticketnomatch:(\" - no match"); }
  28. else
  29. {
  30.  
  31. foreach (Match m in matches)
  32. {
  33. int len = m.Groups["money"].Length;
  34. string currencies = m.Groups["money"].ToString();
  35.  
  36. char currency = currencies[0];
  37. if (len == 10)
  38. {
  39. Console.WriteLine($"ticket \"{m}\" - {len}{currency} Jackpot!");
  40. }
  41. else
  42. {
  43. Console.WriteLine($"ticket \"{m}\" - {len}{currency}");
  44. }
  45.  
  46.  
  47. }
  48. }
  49.  
  50. }
  51.  
  52.  
  53. }// END MAIN
  54.  
  55. }
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement