Advertisement
silvana1303

password

Aug 7th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text.RegularExpressions;
  5.  
  6. namespace _02._Boss_Rush
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Regex regex = new Regex(@"^(.+)\>(\d{3})\|([a-z]{3})\|([A-Z]{3})\|([^\<\>]{3})\<(\1)$");
  13.  
  14.             int times = int.Parse(Console.ReadLine());
  15.  
  16.             for (int i = 0; i < times; i++)
  17.             {
  18.                 string input = Console.ReadLine();
  19.  
  20.                 Match match = regex.Match(input);
  21.  
  22.                 if (match.Success)
  23.                 {
  24.                     string digit = match.Groups[2].Value;
  25.                     string alphabet = match.Groups[3].Value;
  26.                     string uppercase = match.Groups[4].Value;
  27.                     string symbol = match.Groups[5].Value;
  28.  
  29.                     string pass = string.Concat(digit, alphabet, uppercase, symbol);
  30.  
  31.                     Console.WriteLine($"Password: {pass}");
  32.                 }
  33.                 else
  34.                 {
  35.                     Console.WriteLine("Try another password!");
  36.                 }
  37.             }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement