C++ Simple and Short Straight-Forward Solution
Idea:\nWe only need three characters for replacement, because there can\'t be more than one character at each side of the ?.\nSo we try each letter and replace.
**Idea:**\nWe only need three characters for replacement, because there can\'t be more than one character at each side of the `?`.\nSo we try each letter and replace.\n\n**Time Complexity:** O(n)\n**Space Complexity:** None\n```\nclass Solution {\npublic:\n    string modifyString(string s) {\n        for (int i = 0; i < s.size(); i++) {\n            if (s[i] != \'?\') continue;\n            if ((i == 0 || s[i-1] != \'a\') && s[i+1] != \'a\') s[i] = \'a\';\n            else if ((i == 0 || s[i-1] != \'b\') && s[i+1] != \'b\') s[i] = \'b\';\n            else s[i] = \'c\';\n        }\n        return s;\n    }\n};\n```\n**Like it? please upvote!**
['C']