C++ || Easy 0ms Solution with explanation || Only Simulation ||
Intuition\nAs we have to always replace with least possible character so we will only be replacing by either a or b only . Try to think why for some moment and 
# Intuition\nAs we have to always replace with least possible character so we will only be replacing by either a or b only . Try to think why for some moment and you will know the reason . \n(You may ask in comments if you dont get it).\n\n# Approach\nThe Approach is now simple we will traverse string till we dont reach mid or till we dont get other charcter than \'a\'.\nIf We stop before mid that is the character to be replacxed and replace it with a.\nElse we will replace the last character with b .\n\nFor EX : aaaaaaaaaa ,aaacaaa ,\nwill change into aaaaaaaaab, aaacaab.\n\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    string breakPalindrome(string palindrome) {\n        \n        if(palindrome.length() == 1)\n        return "";\n\n        int i = 0 ; \n\n            while(palindrome[i] == \'a\' && i< (palindrome.length())/2 )\n            i++;\n\n            if(i == (palindrome.length())/2)\n            palindrome.back() = \'b\';\n            else\n            palindrome[i] = \'a\';\n\n        return palindrome;\n        \n        \n    }\n};\n```\n
['C++']