C++ solution. || Sort of greedy approach.
You may wanna check out 1054. Distant barcodes.\n\n\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n        string ans = "";\n        int
You may wanna check out ***1054. Distant barcodes.***\n\n```\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n        string ans = "";\n        int a_streak = 0, b_streak = 0;\n        while(a or b) {\n            if(b == 0 or b_streak == 2 or (a > b and a_streak < 2)) {\n                ans += \'a\';\n                a--;\n                a_streak++;\n                b_streak = 0;\n            }\n            else {\n                ans += \'b\';\n                b--;\n                b_streak++;\n                a_streak = 0;\n            }\n        }\n        \n        return ans;\n    }\n};\n```
[]