Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Text.RegularExpressions;
- int o = int.Parse(Console.ReadLine());
- string patternFromOgi = @"^(.+)(>)(?<number>[0-9]{3})(\|)(?<lower>[a-z]{3})(\3)(?<upper>[A-Z]{3})(\3)(?<symbols>.{3})(<)(\1)$";
- for (int i = 0; i < o; i++)
- {
- string inputFromOgi = Console.ReadLine();
- Regex regex = new Regex(patternFromOgi);
- Match match = regex.Match(inputFromOgi);
- if (match.Success)
- {
- string numbersFromOgi = match.Groups["number"].ToString();
- string lowerFromOgi = match.Groups["lower"].ToString();
- string upperFromOgi = match.Groups["upper"].ToString();
- string symbolsFromOgi = match.Groups["symbols"].ToString();
- string finalPasswordFromOgi = numbersFromOgi + lowerFromOgi + upperFromOgi + symbolsFromOgi;
- Console.WriteLine($"Password: {finalPasswordFromOgi}");
- }
- else
- {
- Console.WriteLine("Try another password!");
- }
- }
Add Comment
Please, Sign In to add comment