Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace Playing
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 1; i <= n; i++)
- {
- string password = Console.ReadLine();
- Regex regex = new Regex(@"(\S+)>(\d{3})\|([a-z]{3})\|([A-Z]{3})\|([^<>]{3})<\1");
- bool match = regex.IsMatch(password);
- if (match == false)
- {
- Console.WriteLine("Try another password!");
- continue;
- }
- else
- {
- Match matching = regex.Match(password);
- string numbers = matching.Groups[2].Value;
- string lowerLetters = matching.Groups[3].Value;
- string upperLetters = matching.Groups[4].Value;
- string symbols = matching.Groups[5].Value;
- string output = numbers + lowerLetters + upperLetters + symbols;
- Console.WriteLine($"Password: {output}");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment