just check last two chars and append the different one to break the trio
\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n        \n        string res = "";\n        while(a>0 or b>0)\n        {\n            if
```\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n        \n        string res = "";\n        while(a>0 or b>0)\n        {\n            if(b>0 && res.size()>=2 && res[res.size()-1] !=\'b\' && res[res.size()-2] !=\'b\')\n            {\n                res+=\'b\';\n                b--;\n            }\n            else if(a>0 && res.size()>=2 && res[res.size()-1] !=\'a\' && res[res.size()-2] !=\'a\')\n            {\n                res+=\'a\';\n                a--;\n            }\n            else if(a>b && a>0)\n            {\n                res+=\'a\';\n                a--;\n            }\n            else if(b>0)\n            {\n                b--;\n                res+=\'b\';\n            }\n                \n        }\n        return res;\n            \n        \n    }\n};\n```
[]