【模拟】力扣1576(Java)
class Solution
{
public String modifyString(String ss)
{
char[] s = ss.toCharArray();
int n = s.length;
for(int i=0;i<n;i++)
{
if(s[i] == '?')
{
for(char ch='a';ch<='z';ch++)
{
if((i == 0 || ch!=s[i-1])&&(i == n-1 || ch!= s[i+1]))
{
s[i] = ch;
break;
}
}
}
}
return String.valueOf(s);
}
}
原文地址:https://blog.csdn.net/qq_62552630/article/details/135775411
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!