Implement the EnScript CHS command
Python 3, 262 ... 170 bytes
This program outputs the result via Stderr.
I'm a bit out of practice at golfing, since I have not been too active lately, so I'm sure it can be golfed more.

L=[[c,int(c)]for c in input()]
while 1:i=L.index(min([x for x in L if x[1]]or exit(str(int(&quot;&quot;.join(x[0]for x in L))))));L[i][1]-=1;q=i+1&lt;len(L)and-~i;L.insert(q,L.pop(i))

Try it online
Ungolfed
# Index to shift, Times remaining
def Shift(i, t):
    if t&lt;1:
        L[i][1]=0
        return
    if i+1&lt;len(L):
        L[i],L[i+1]=L[i+1],L[i]
        Shift(i+1,t-1)
    else:
        L.insert(0,L.pop())
        Shift(0,t-1)
L=[[c,1]for c in input()]
while 1:
    t=[x for x in L if x[1]]or exit(&quot;&quot;.join(x[0]for x in L).lstrip('0'))
    i=L.index(min(t,key=lambda x:x[0]))
    Shift(i,int(L[i][0]))