Greedy Solution
IntuitionApproachComplexity
Time complexity:
O(a+b)

Space complexity:
O(a+b)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
- O(a+b)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
- O(a+b)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    string strWithout3a3b(int a, int b) {
        string ans;
        while(a || b){
            bool writeA = false;
            int len = ans.size();
            if(len>=2 && ans[len-1]==ans[len-2]){
                if(ans[len-1]=='b')writeA=true;
            }else{
                if(a>=b)writeA=true;
            }

            if(writeA){
                ans+='a';
                a--;
            }else{
                ans+='b';
                b--;
            }
        }
        return ans;
    }
};
```
['C++']