Tags: algorithms python programming 

Rating:

```
from pwn import *
def sort_vet(x):
s = ''
for i in range(len(x)):
for j in range(len(x) - 2, -1, -1):
if x[j] > x[j + 1]:
x[j], x[j + 1] = x[j + 1], x[j]
s = s + str(j) + ' '
return s
nc = remote('challenges.ctfd.io', 30267)
nc.sendlineafter('Enter 1, 2, 3, 4, or 5.\n', '2')
nc.recvline()
nc.recvline()
nc.recvline()
nc.recvline()
x = nc.recvline().decode().strip().replace(' ', '').split(',')
nc.recv()
nc.sendline(sort_vet(x))
nc.recvline()
nc.recvline()
x = nc.recvline().decode().strip().replace(' ', '').split(',')
print(nc.recv().decode())
```
```
[x] Opening connection to challenges.ctfd.io on port 30267
[x] Opening connection to challenges.ctfd.io on port 30267: Trying 159.203.148.124
[+] Opening connection to challenges.ctfd.io on port 30267: Done
???????? That's correct!! ????????
nactf{d0n7_w0rry_p34_h4ppy_f27ae283dd72cb62f685}
```
```
nactf{d0n7_w0rry_p34_h4ppy_f27ae283dd72cb62f685}
```