Submit | All submissions | Best solutions | Back to list |
STARJUST - Star Justify |
Pad strings with asterisks on either side to fill a given size of space. The string should appear in the centre, but if equal padding is not possible then the shorter padding should appear on the right of the string.
Input
The first line of the input contains the number of test cases. Each consecutive pair of lines provides an integer representing the size of space to fill and a string that needs to be padded.
Output
One string per line, which should be the asterisk-padded strings
Example
Input: 3
10
hello
10
milk
30
to be, or not to be Output: ***hello**
***milk***
******to be, or not to be*****
Added by: | handee |
Date: | 2021-06-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NCSHARP JULIA PYPY3 |