C++ Solution || 0 ms, Faster than 100% of Submissions
\nclass Solution {\n  public:\n    string breakPalindrome(string palindrome) {\n      set < char > s;\n      int n = palindrome.size();\n      if (n == 1) retur
```\nclass Solution {\n  public:\n    string breakPalindrome(string palindrome) {\n      set < char > s;\n      int n = palindrome.size();\n      if (n == 1) return "";\n      for (int i = 0; i < (palindrome.size() + 1) / 2; i++) {\n        s.insert(palindrome[i]);\n      }\n      if (s.size() == 1) {\n        if (palindrome[0] == \'a\') palindrome[n - 1] = \'b\';\n        else palindrome[0] = \'a\';\n        return palindrome;\n      }\n      int cnt = 0;\n      for (int i = 0; i < palindrome.size(); i++) {\n        if (palindrome[i] != \'a\') {\n          if (i != n / 2)\n            palindrome[i] = \'a\';\n          else {\n            for (int k = i + 1; k < n; k++) {\n              if (palindrome[k] != \'a\') {\n                palindrome[n / 2] = \'a\';\n                cnt++;\n                break;\n              }\n            }\n            if (!cnt) palindrome[n - 1] = \'b\';\n          }\n          break;\n        }\n      }\n      return palindrome;\n    }\n};\n```
['C++']