Java easy understand with comment
\nclass Solution {\n    public String strWithout3a3b(int a, int b) {\n        // if a > b, swap a and b\n        if (b > a) \n\t\t\treturn  helper(a, b);\n     
```\nclass Solution {\n    public String strWithout3a3b(int a, int b) {\n        // if a > b, swap a and b\n        if (b > a) \n\t\t\treturn  helper(a, b);\n        \n        StringBuilder sb = new StringBuilder();\n        // build string like "abababab...."\n        while (a > 0 && b > 0) {\n            sb.append("ab");\n            a--;\n            b--;\n        }\n        int size = sb.length();\n        // insert 1 \'a\' before 1 \'b\'\n        for (int i = 1; a > 2; i = i + 3) {\n            sb.insert(i, "a");\n            a--;\n        }\n        // append last 2 \'a\'\n        while (a > 0) {\n            sb.append("a");\n            a--;\n        }\n        return sb.toString();\n    }\n\tprivate String helper(int a, int b) {\n        StringBuilder sb = new StringBuilder();\n\t\tString s = strWithout3a3b(b, a);\n\t\tfor (int i = 0; i < s.length(); i++) {\n\t\t\tchar c = s.charAt(i);\n\t\t\tif (c == \'a\') \n\t\t\t\tsb.append(\'b\');\n\t\t\tif (c == \'b\') \n\t\t\t\tsb.append(\'a\');\n\t\t}\n\t\treturn sb.toString();\n\t}\n}\n```
[]