CPP || EASY || 3ms
\nclass Solution {\npublic:\n    string modifyString(string s) {\n        for(int i=0;i<s.length();i++){\n            if(i==0 && s[i]==\'?\') s[i]=(s[i+1]+1)%26
```\nclass Solution {\npublic:\n    string modifyString(string s) {\n        for(int i=0;i<s.length();i++){\n            if(i==0 && s[i]==\'?\') s[i]=(s[i+1]+1)%26+\'a\';\n            else if(i==s.length()-1 && s[i]==\'?\') s[i]=(s[i-1]-\'a\'+1)%26+\'a\';\n            else if(s[i]==\'?\'){\n                int p=1;\n                while(s[i]==s[i-1] || s[i]==s[i+1] || s[i]==\'?\'){\n                    s[i]=(max(s[i-1]-\'a\',s[i+1]-\'a\')+p)%26+\'a\';\n                    p++;\n                }\n            }\n        }\n        return s;\n    }\n};\n```
['C++']