理论上是26个小写字母,但只要前后不同,3个即可
class Solution {
public String modifyString(String s) {
char[]array=s.toCharArray();
for(int i=0;i<array.length;i++){
if(array[i]=='?'){
for (char ch = 'x'; ch <= 'z'; ++ch) {
if ((i > 0 && array[i - 1] == ch) || (i < array.length- 1 && array[i + 1] == ch)) {
continue;
}
array[i] = ch;
break;
}
}
}
return new String(array);
}
}