Advertisement
North_Point

01. Cards

Aug 7th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _01.Cards
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             var regex = @"(?<=[SHDC]|^)([2-9JQKA]|10)[SHDC]";
  15.             var input = Console.ReadLine();
  16.             var matches = Regex.Matches(input,regex);
  17.             var lis = new List<object>();
  18.  
  19.             foreach (Match item in matches)
  20.             {
  21.                 lis.Add(item);
  22.             }
  23.             Console.WriteLine(string.Join(", ",lis));
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement