def sortStack(stack):
    help = []
    while stack != []:
        cur = stack.pop()
        while help != [] and cur > help[-1]:
            stack.append(help.pop())
        help.append(cur)
    while help != []:
        stack.append(help.pop())
    return stack


a = [1, 3, 2, 4, 4, 2, 6]
print(sortStack(a))

1fe469394e32a1954db003df07f2006fed588359
<mask token>

def sortStack(stack):
    help = []
    while stack != []:
        cur = stack.pop()
        while help != [] and cur > help[-1]:
            stack.append(help.pop())
        help.append(cur)
    while help != []:
        stack.append(help.pop())
    return stack


<mask token>

def sortStack(stack):
    help = []
    while stack != []:
        cur = stack.pop()
        while help != [] and cur > help[-1]:
            stack.append(help.pop())
        help.append(cur)
    while help != []:
        stack.append(help.pop())
    return stack


<mask token>
print(sortStack(a))

def sortStack(stack):
    help = []
    while stack != []:
        cur = stack.pop()
        while help != [] and cur > help[-1]:
            stack.append(help.pop())
        help.append(cur)
    while help != []:
        stack.append(help.pop())
    return stack


a = [1, 3, 2, 4, 4, 2, 6]
print(sortStack(a))
