l=[int(i) for i in input().split()]
low=mid=0
high=len(l)-1
while(mid<=high):
    if(l[mid]==0):
        l[low],l[mid]=l[mid],l[low]
        mid+=1
        low+=1
    elif(l[mid]==1):
        mid+=1
    else:
        l[high],l[mid]=l[mid],l[high]
        high-=1
print(l)        
        

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: