The Dutch flag problem
Description The Dutch flag problem is to rearrange an array of characters R, W,and B (red, white, and blue are the colors of the Dutch national flag) so that all the R’s come first, the W’s come next, and the B’s come last.
Design a linear and stable algorithm for this problem.
Input
two lines, the first line is total of numbers characters R,W and B ,and the numbers less than 500005
the second line is random characters R,W and B
Output
a line, all the R’s come first, the W’s come next, and the B’s come last.
Sample Input
10
WRRWRWBBRW
Sample Output
RRRRWWWWBB