for i in range(x - 1): for j in range(x - 1 - i): if s[j]>s[j + 1]: s[j],s[j + 1] = s[j + 1],s[j] print(*s, sep=' ')