You're given a string s containing lowercase English letters and mysterious ? characters. Your mission is to replace every question mark with a lowercase letter such that no two adjacent characters in the final string are identical.
Think of the question marks as blank spaces that need to be filled wisely. You cannot change any existing letters - only the question marks are yours to modify.
The good news: The input string is guaranteed to have no consecutive repeating letters among the non-? characters, so a solution always exists!
Goal: Return any valid string where all ? characters have been replaced with letters, and no two consecutive characters are the same.
Example: "?zs" could become "azs" or "bzs", but not "zzs" since that would create consecutive identical characters.
Input & Output
Constraints
- 1 โค s.length โค 105
- s consists of lowercase English letters and '?' characters only
- No consecutive repeating characters exist in the input (except '?')
- A solution always exists with the given constraints