C++ solution
\nclass Solution {\npublic:\n    string modifyString(string s) {\n        \n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'?\')\n       
```\nclass Solution {\npublic:\n    string modifyString(string s) {\n        \n        for(int i=0;i<s.size();i++)\n        {\n            if(s[i]==\'?\')\n            {\n                for(char ch=\'a\';ch<=\'z\';ch++)\n                {\n                    if(i==0 && s[i+1]!=ch)\n                    {\n                        s[i]=ch;\n                        break;\n                    }\n                    else if(i==s.size()-1 && s[i-1]!=ch)\n                    {\n                        s[i]=ch;\n                        break;\n                    }\n                    else if(s[i+1]!=ch && s[i-1]!=ch){\n                        s[i]=ch;\n                        break;\n                    }\n                }\n            }\n           \n        }\n        return s;\n        \n    }\n};\n```
[]