Implement Wordle Guess Scoring
Problem Implement Wordle's guess scoring. Given a secret word and a guess of the same length, return a per-position result of green (right letter, right spot), yellow (letter present elsewhere), or grey (letter not present), handling duplicate letters correctly.
Input / Output
- Input: two equal-length strings,
guessandsecret. - Output: a length-n result marking each position green / yellow / grey.
Constraints
- Duplicate letters must be scored correctly: a letter can be marked yellow only as many times as it remains in the secret after greens are accounted for.
- Guess and secret have equal length.
Example
scoreGuess("allol", "hello")-> greens where letters align, yellows only for surplus letters still available, greys otherwise.scoreGuess("speed", "abcde")-> the two 'e's cannot both be yellow if the secret has only one 'e' left after greens.
added …