Ducks in a Row
Output: Standard Output (stdout)
Memory limit: 128 megabytes
Time limit: 1.1 seconds
Ducks come in many different shapes and sizes.
In fact, they come in three different sizes: small (S), medium (M), and large (L).
As we all know, before a contest you should always have your ducks in a row. However, because you might have different sized ducks, you might need multiple rows - one for each size. To make sure you can see all of your ducks, you should have the largest ducks at the back and the smallest at the front. Additionally, each row should be centered relative to the longest row. If it's not possible to center a row perfectly, then the row can have more ducks on the left side, but it should still be as close to centered as possible.
Get quacking! The contest has started!
There will be three lines, containing the numbers N_S, N_M, N_L (number of small, medium, and large ducks) respectively.
- 0 \leq N_S, N_M, N_L \leq 1000.
- There will always be at least one duck.
Output three lines, one for each row. Use the characters S, M, and L to represent small, medium, and large ducks respectively, and use an underscore _ to represent an empty space.
- The first line should be the furthest back row, which contains all the large ducks.
- The second line should be the middle row, which contains all the medium ducks.
- The third line should be the furthest forward row, which contains all the small ducks.
The row with the most ducks shouldn't have any empty spaces, and every line should have the same number of characters. For the purposes of this problem, we assume that every duck (regardless of size) takes up the same width.
- Subtask 1 (+40%): N_S=0 and N_M=0 (in other words, there are only large ducks). Note that only Sample Input 3 is from this subtask.
- Subtask 2 (+60%): No further constaints apply.
Sample Input 1
7 9 5
Sample Output 1
__LLLLL__ MMMMMMMMM _SSSSSSS_
Sample Input 2
6 5 0
Sample Output 2
______ MMMMM_ SSSSSS
Sample Input 3
0 0 3
Sample Output 3
LLL ___ ___