Simple Greedy method(faster than 100.00% of Java online submissions)
Greedy by the number of \'a\' and \'b\';\nRuntime: 3 ms, faster than 100.00% of Java online submissions for String Without AAA or BBB.\n\n\n\nclass Solution {\n
Greedy by the number of \'a\' and \'b\';\nRuntime: 3 ms, faster than 100.00% of Java online submissions for String Without AAA or BBB.\n\n```\n\nclass Solution {\n    public String strWithout3a3b(int A, int B) {\n        StringBuilder sb = new StringBuilder();\n        while(A>B && B > 0){\n            sb.append("aab");\n            A-=2;\n            B--;\n        }\n        \n        while(B>A && A>0) {\n            sb.append("bba");\n            A--;\n            B-=2;\n        }\n        while (A > 0 && B >0) {\n            sb.append("ab");\n            A--;\n            B--;\n        }\n        while(A>0){\n            sb.append("a");\n            A--;\n        }\n        while(B>0) {\n            sb.append("b");\n            B--;\n        }\n        return sb.toString();\n    }\n}\n\n```
[]