A higher resolution is required to access the IDE
- 6
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
You like to play 'Wordle' and decide to code up a script to produce a simple RegEx ('Regular Expression') pattern to filter words that match your information about the 5 letter word.You are given an input n and then n lines of pairs of guess and result, representing words that have been guessed and information about the correctness of each letter, respectively.
e.g.
A result of
You can capture this in RegEx! Of course, there are many different ways to do it, so you've defined a specific way that you want to generate it. Details are below:
• The RegEx starts with a
• Whenever letters are grouped together in square brackets, they appear in alphabetical order. (e.g.
• Any letters with a
• Any letters with a
Be sure not to include letters in the look-ahead that have had
• Any positions that haven't received a
•
• Any positions with a
You can test your RegEx on the RegEx dictionary by Lou Hevly to see which words match your answers: https://www.visca.com/regexdict/
Example 1
2
paper ___G_
boils _G___
Answer
Solution
There are no
Example 2
2
waged __YG_
boils _G__G
Answer
Solution
The only
Input
Line 1 : An integer n, the number of guesses made
Next n lines : A space-separated guess and result, both 5 characters
Next n lines : A space-separated guess and result, both 5 characters
Output
1 line : The RegEx capturing all possible solutions, structured as described
Constraints
0 ≤ n ≤ 6
Each guess will always be in lowercase
Each guess will always be in lowercase
Example
Input
0
Output
^.....$
A higher resolution is required to access the IDE