Given counts a, b, and c of available characters 'a', 'b', and 'c', build a string of maximum length that uses no more than a a's, b b's, and c c's, and contains no three identical consecutive characters. Return any such string. The reference solution greedily appends from the most-abundant remaining character (using a max-heap), swapping in the next-most-abundant character when adding the top would form a triple.
Input
a: the maximum number of 'a' characters
b: the maximum number of 'b' characters
c: the maximum number of 'c' characters
Output
A string of maximum possible length with no three identical consecutive characters.
Examples
Example 1
Inputa = 1, b = 1, c = 6
Output"ccaccbcc"
Example 2
Inputa = 1, b = 2, c = 3
Output"cbcabc"
Constraints
a, b, c >= 0.
No three consecutive characters in the output may be the same.