C++ || Easy to understand || 100% fast✔
\n\n# Code\n\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n       string ans="";  //String to store the answer\n        int counta=0,co
\n\n# Code\n```\nclass Solution {\npublic:\n    string strWithout3a3b(int a, int b) {\n       string ans="";  //String to store the answer\n        int counta=0,countb=0; // Counter to check that a and b should not be greater than two;\n        int total=a+b;         //No of times the loop will run;\n        for(int i=0;i<total;i++)\n        {\n            if((b>=a && countb<2) || (counta==2 && b>0)) //If b is greater than a and count of b is less than 2 || if count of a ==2 and b is greater than 2 add \'a\';\n            {\n                ans+=\'b\';\n                b--;    // decrement given count of b;\n\n                countb++; //increment count of b;\n\n                counta=0; // make the count of a to 0 , if we don\'t do that then the length of the string will remain 3 because counta<2 || countb<2 condition will never become true after the string size becomes three that\'s why we are making counta=0 and countb=0 in every condition;\n            }\n            else if((a>=b && counta<2) || (countb==2 && a>0))\n            {\n                ans+=\'a\';\n                a--;\n                counta++;\n                countb=0;\n            }\n        }\n        return ans; // Return the answer;\n    }\n};\n```
['C++']