-->
当前位置:首页 > 题库

PROGRAMMING:Left-pad

Luz5年前 (2021-05-10)题库496
According to Sina Weibo, a developer was dissatisfied with NPM (node package manager) and withdrew his open source code, including a module called left pad, which paralyzed react / Babel in JavaScript. What kind of module is this? That is to fill some things in front of the string to a certain length. For example, if you use '*' to fill in the string 'gplt' and make it 10 long, the result of calling left pad should be '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *. The Node community once issued an alternative to left-pad, make complaints about it. Now please implement this module.
###Input format:
Input in the first line to give a positive integer 'n' ($$$Le 10 ^ 4 $$) and a character, which are the length of the filling result string and the characters used for filling, separated by a space. The second line gives the original non empty string, ending with a carriage return.
###Output format:
Output the result string on one line.
###Input sample 1:
```in
15 _
I love GPLT
```
###Output sample 1:
```out
____ I love GPLT
```
###Input example 2:
```
4 *
this is a sample for cut
```
###Output example 2:
```
cut
```






answer:If there is no answer, please comment