Best Java Solution || Beats 100%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String breakPalindrome(String s) {\n        int n = s.length();\n\n        if(n==1) return "";\n\n        StringBuilder ans = new StringBuilder(s);\n        boolean flag = false;\n\n        for(int i=0; i<n/2; i++){\n            char ch = ans.charAt(i);\n            if(ch!=\'a\'){\n                int x = ans.indexOf(ch+"");\n                ans.replace(x,x+1,"a");\n                flag = true;\n                break;\n            }\n        }\n        if(flag==false){  // in case that all character are \'a\'\n            ans.replace(n-1,n,"b");\n        }\n\n        return ans.toString();\n    }\n}\n```
['Java']