class Solution:
def breakPalindrome(self, s: str) -> str:
""" tc O(N) sc O(N)
main idea: loop through half of the string, find the first char not equal to 'a', change it to 'a'
otherwise: change last position'char to 'b'
"""
n = len(s)
if n == 1:
return ""
res = list(s)
for i in range(n//2):
if s[i] != 'a':
res[i] = 'a'
return ''.join(res)
res[-1] = 'b'
return ''.join(res)