using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; using System.Text.RegularExpressions; namespace apps { class Program { static string Get() { return Console.ReadLine(); } static void Main() { // ticket string raw = Get(); string pattern = @"[A-Za-z]*(?[$|@|#|^]{6,10})[A-Za-z]*[$|@|#|^]{6,10}[A-Za-z]*"; //------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------- MatchCollection matches = Regex.Matches(raw, pattern); if (matches.Count == 0) { Console.WriteLine("ticket \"validticketnomatch:(\" - no match"); } else { foreach (Match m in matches) { int len = m.Groups["money"].Length; string currencies = m.Groups["money"].ToString(); char currency = currencies[0]; if (len == 10) { Console.WriteLine($"ticket \"{m}\" - {len}{currency} Jackpot!"); } else { Console.WriteLine($"ticket \"{m}\" - {len}{currency}"); } } } } }// END MAIN }