java || hindi || faster than 100%
\nclass Solution {\n    public String breakPalindrome(String s) {\n        int len = s.length();\n        StringBuilder sb = new StringBuilder(s);\n        if(l
```\nclass Solution {\n    public String breakPalindrome(String s) {\n        int len = s.length();\n        StringBuilder sb = new StringBuilder(s);\n        if(len<=1) {\n            return "";\n        }\n        // since its a pallindrome, we will check for only half string\n        // agar odd h to len/2 , even hai to len/2+1, tak loop chaalo\n        int endpoint = len%2==0 ? len/2 : (len/2)+1;\n        // ek variable rakha, jisse pta chle change hua ya nhi\n        boolean changed = false;\n            for(int i=0;i<endpoint;i++) {\n       /*\n       LOGIC SAMJO\n       jo bhi string h usme , sabse pehle jo character aa rha, jo \'a\' nhi h , usko \'a\' krdo, to smallest leographic hoga\n       */\n                \n                if(s.charAt(i)!=\'a\') {\n                    // SPECIAL CASE (read it later neeche padh lo fr aana)\n                   /*maanlo aabaa input h, ab agar \'b\' ko \'a\' krdiya, to pallindrome bn gya \n                    aabaa, lelo isme agar i = endpoint-1,\n                    endpoint = 5/2+1 = 3;\n                    i agar aab me 2 pe ho, mtlb \'b\' par, endpoint-1==2\n                    to agar hum \'b\' par hai and usse agle char bhi \'a\' hai\n                    and pichle to saare \'a\' hai hi, nhi to neeche wala break krdeta naa\n                    */\n                    if(i==endpoint-1 && s.charAt(i+1)==\'a\') {\n                        break;\n                    }\n                    // \'a\' nhi h , a krdo\n                    sb.setCharAt(i,\'a\');\n                    // a krdiya to change true\n                    changed = true;\n                    // ho gya naa change break krdo , aage kyu jaana\n                    break;\n                }\n            }\n        /* ab agar change nhi hua\n        to yaa to aaaa, aaa, aabaa, aisa kuch raha hoga,\n        is case me ya to saare \'a\' hai, yaaa fr vo wala case jisme middle element alag h ,\n        par usko change krde to pallindorme bn jaata, like \'aabaa\' me b ko a krdiya to \'aaaaa\'\n        to humnne soch aakhri index pe jo \'a\' hai usko \'b\' krdo\n        */\n        if(!changed) {\n        if(s.equals(sb.toString())) {\n            sb.setCharAt(len-1,\'b\');\n        }\n        }\n        return sb.toString();\n    }\n}\n```
[]