Wordle Feedback
Problem statement
The uppercase strings answer and guess have equal length and contain no repeated letter within either word.
Return one feedback character per guess position: G when the letter and position match, Y when the letter occurs elsewhere in answer, and _ when the letter is absent.
Function
wordleFeedback(answer: String, guess: String) → StringExamples
Example 1
answer = "ABCD"guess = "ACDE"return = "GYY_"A is exact, C and D are present at other positions, and E is absent.
Example 2
answer = "PHONE"guess = "HOWLS"return = "YY___"H and O occur in the answer but both are misplaced.
Example 3
answer = "PHONE"guess = "WALKS"return = "_____"No guessed letter occurs in the answer.
Constraints
1 <= answer.length == guess.length <= 26.- Both strings contain distinct uppercase English letters.