Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 095242f

Browse files
Merge pull request youngyangyang04#2445 from zhaohany/master
Update kama55.右旋字符串.md
2 parents 6be5368 + c4ad2ec commit 095242f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎problems/kama55.右旋字符串.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,16 @@ public class Main {
211211
```
212212

213213
### Python:
214-
214+
```Python
215+
#获取输入的数字k和字符串
216+
k = int(input())
217+
s = input()
218+
219+
#通过切片反转第一段和第二段字符串
220+
#注意:python中字符串是不可变的,所以也需要额外空间
221+
s = s[len(s)-k:] + s[:len(s)-k]
222+
print(s)
223+
```
215224

216225
### Go:
217226
```go

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /