A simple Java recursion solution
\nclass Solution {\n    StringBuilder sb = new StringBuilder();\n    public String strWithout3a3b(int A, int B) {\n        if (A == 0 || B == 0) {\n            
```\nclass Solution {\n    StringBuilder sb = new StringBuilder();\n    public String strWithout3a3b(int A, int B) {\n        if (A == 0 || B == 0) {\n            while (A-- > 0) sb.append(\'a\');\n            while (B-- > 0) sb.append(\'b\');\n        } else if (A == B) {\n            sb.append("ab");\n            strWithout3a3b(A - 1, B - 1);\n        } else if (A > B) {   // A > B > 0\n            sb.append("aab");\n            strWithout3a3b(A - 2, B - 1);\n        } else {              // B > A > 0\n            sb.append("bba");\n            strWithout3a3b(A - 1, B - 2);\n        }\n        return sb.toString();\n    }\n}\n```
['Recursion', 'Java']