python 3  ||  8 lines, one-pass  ||  T/S: 99% / 99%
\nclass Solution:\n    def breakPalindrome(self, p: str) -> str:\n        \n        n = len(p)\n        if n < 2: return \'\'\n        \n        for i in range(
```\nclass Solution:\n    def breakPalindrome(self, p: str) -> str:\n        \n        n = len(p)\n        if n < 2: return \'\'\n        \n        for i in range(n//2):\n            \n            if p[i] != \'a\':\n                p = p[:i] + \'a\' + p[i+1:]\n                break\n                \n        else: p = p[:-1] + \'b\'\n            \n        return p\n```\n[https://leetcode.com/problems/break-a-palindrome/submissions/559838984/](https://leetcode.com/problems/break-a-palindrome/submissions/559838984/)\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(1), in which *N* ~ `len(p)`.
['Python', 'Python3']