Joseph has a list of
cards ranging from 2-10 that contains all suits in the deck(Excluding Jacks, Queens, Kings, Jokers, Aces). Your job is to sort Joseph's deck into two separate piles, one with only Black and one with Red. Both should be ordered from least to greatest. Red cards have the prefix R and Black cards have the prefix B. Red has to be displayed first. Joseph has given you a a list of cards in one line separated by single spaces.
Output Specification
Output 2 lines with the red cards in order from least to greatest followed by in the next line black cards from least to greatest. Nothing should be printed if no card was given for the card type.
Sample Input
R6 R5 B3 R2 B9
Sample Output
R2 R5 R6
B3 B9
Comments