parent
6be53682d0
commit
2c160f31c5
|
|
@ -211,7 +211,17 @@ public class Main {
|
||||||
```
|
```
|
||||||
|
|
||||||
### Python:
|
### Python:
|
||||||
|
```Python
|
||||||
|
#注意:python中字符串是不可变的,所以使用python一定要创建新的字符串
|
||||||
|
|
||||||
|
#获取输入的数字k和字符串
|
||||||
|
k = int(input())
|
||||||
|
s = input()
|
||||||
|
|
||||||
|
#通过切片反转第一段和第二段字符串
|
||||||
|
s = s[len(s)-k:] + s[:len(s)-k]
|
||||||
|
print(s)
|
||||||
|
```
|
||||||
|
|
||||||
### Go:
|
### Go:
|
||||||
```go
|
```go
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue