C++ : Simple solution by only checking for 2 chars 'a', 'b'
class Solution {\npublic:\n    string breakPalindrome(string p) {\n        int n = p.size();\n        if(n==1) return "";\n        for(int i = 0; i < n/2; i++){
class Solution {\npublic:\n    string breakPalindrome(string p) {\n        int n = p.size();\n        if(n==1) return "";\n        for(int i = 0; i < n/2; i++){\n            if (p[i]!=\'a\') {\n                p[i]=\'a\';\n                return p;\n            }\n        }\n        for(int i = 0; i < n/2; i++){\n            if (p[n-1-i]!=\'b\') {\n                p[n-1-i]=\'b\';\n                return p;\n            }\n        }\n        return "";\n    }\n};
[]