Python 99% - Greedy Approach with comments
\n# M1 - longer\nclass Solution:\n    def strWithout3a3b(self, a: int, b: int) -> str:\n        \n        # INIT empty string\n        res = ""\n        availab
```\n# M1 - longer\nclass Solution:\n    def strWithout3a3b(self, a: int, b: int) -> str:\n        \n        # INIT empty string\n        res = ""\n        available = {\'a\': a, \'b\': b}\n        \n        # While there are still letters to add\n        while a > 0 or b > 0:\n            \n            currLetter = ""\n            \n            # Loop through the letters\n            for letter, count in available.items():\n                \n                # CHECK if addition of letter is valid\n                if len(res) >= 2 and res[-2:] != letter*2 and available[letter]>0 or len(res)<2 and available[letter]>0:\n                    # If letter not assigned, add this\n                    if not currLetter:\n                        print("if not currLetter", letter)\n                        currLetter = letter\n                    \n                    # ELSE if letter is assigned already, check if current letter is better (larger count) => reassign\n                    else: \n                        if available[letter] > available[currLetter]:\n                            print("reassinged currLetter", letter)\n                            currLetter = letter\n                            \n                \n            # END if we cant find any valid letters\n            if not currLetter: \n                break\n            \n            res += currLetter\n            available[currLetter] -= 1\n            \n        # RETURN res\n        return res\n\n# M2 - shorter\nclass Solution(object):\n    def strWithout3a3b(self, A: int, B: int) -> str:\n        ans = []\n\n        while A or B:\n            # If there is consecutive 2 => need to check if is A or B, so we can avoid\n            if len(ans) >= 2 and ans[-1] == ans[-2]:\n                writeA = ans[-1] == \'b\' # If is B, we can only add A next\n                \n            else: # No restriction, add the one with largest count\n                writeA = A >= B \n            \n            # Note: We dont need to check if letter count is 0 \n            # because all count will be used in the string (as indicated in question)\n            \n            if writeA:\n                A -= 1\n                ans.append(\'a\')\n            else:\n                B -= 1\n                ans.append(\'b\')\n\n        return "".join(ans)\n```
['Greedy', 'Python', 'Python3']