Easy [C++] Greedy Solution 0ms
\nclass Solution {\npublic:\n    string strWithout3a3b(int A, int B) {\n        string ans = "";\n        while(A>0 or B>0)\n        {\n            int n = ans.
```\nclass Solution {\npublic:\n    string strWithout3a3b(int A, int B) {\n        string ans = "";\n        while(A>0 or B>0)\n        {\n            int n = ans.size();\n            if(n>1 and ans[n-1]==\'a\' and ans[n-2]==\'a\')\n                ans+=\'b\', B--;\n\n            else if(n>1 and ans[n-1]==\'b\' and ans[n-2]==\'b\')\n                ans+=\'a\', A--;\n            \n            else\n            {\n                if(A>B) \n                    ans+=\'a\', A--;\n                else \n                    ans+=\'b\', B--;\n            }\n        }\n        return ans;\n    }\n};\n```
[]