代码能看懂,但是它是怎么找出最小的字典序的字符串的啊
![](http://static.tieba.baidu.com/tb/editor/images/client/image_emoticon9.png)
import osimport sys
n,x = map(int,input().split())
s = sorted(input())
if s[lbk]0[rbk] !=s[lbk]x-1[rbk]:
print(s[lbk]x-1[rbk])
elif s[lbk]x[rbk] == s[lbk]-1[rbk]:
print("".join(s[lbk]::x[rbk]))
else: print("".join(s[lbk]x-1::[rbk]))
![](http://tiebapic.baidu.com/forum/w%3D580/sign=8fa0442d04a7d933bfa8e47b9d4bd194/0fc1cf11728b4710390183f585cec3fdfc0323b9.jpg?tbpicau=2024-09-19-05_9c40bf31769a46636ec2512efeb7108d)