def sort(arr)
n = arr.length-1
for i in 0..n-1
min = arr[i]
pos = i
for j in i + 1..n
if arr[j] < min
min = arr[j]
pos = j
end
end
aux = arr[pos]
arr[pos] = arr[i]
arr[i] = aux
end
end
def distinct(arr)
x = [1,-2,-2,3,4,5,5,-2,1,10,20,30,10]
y = []
k = 0
sort(x)
k = 0
y[k] = x[k]
for i in 0..x.length-2
if x[i] != x[i+1]
k += 1
y[k] = x[i+1]
end
end
print y
end
def main
arr = [1,-2,-2,3,4,5,5,-2,1,10,20,30,10]
n = arr.length-1
for i in 0..n-1
if arr[i] != 0
print arr[i], " "
for j in i + 1..n
if arr[i] == arr[j]
arr[j] = 0
end
end
end
end
end
main
distinct([])
ZGVmIHNvcnQoYXJyKQogICAgbiA9IGFyci5sZW5ndGgtMQogICAgZm9yIGkgaW4gMC4ubi0xCiAgICAgIG1pbiA9IGFycltpXQogICAgICBwb3MgPSBpCiAgICAgIGZvciBqIGluIGkgKyAxLi5uCiAgICAgICAgICBpZiBhcnJbal0gPCBtaW4KICAgICAgICAgICAgbWluID0gYXJyW2pdCiAgICAgICAgICAgIHBvcyA9IGoKICAgICAgICAgIGVuZAogICAgICBlbmQKICAgICAgYXV4ID0gYXJyW3Bvc10KICAgICAgYXJyW3Bvc10gPSBhcnJbaV0KICAgICAgYXJyW2ldID0gYXV4CiAgICBlbmQKZW5kCmRlZiBkaXN0aW5jdChhcnIpCiAgICB4ID0gWzEsLTIsLTIsMyw0LDUsNSwtMiwxLDEwLDIwLDMwLDEwXQogICAgeSA9IFtdCiAgICBrID0gMAogICAgc29ydCh4KQogICAgayA9IDAKICAgIHlba10gPSB4W2tdCiAgICBmb3IgaSBpbiAwLi54Lmxlbmd0aC0yCiAgICAgICAgaWYgeFtpXSAhPSB4W2krMV0KICAgICAgICAgICBrICs9IDEKICAgICAgICAgICB5W2tdID0geFtpKzFdCiAgICAgICAgZW5kCiAgICBlbmQKICAgIHByaW50IHkKZW5kCmRlZiBtYWluCiAgICBhcnIgPSBbMSwtMiwtMiwzLDQsNSw1LC0yLDEsMTAsMjAsMzAsMTBdCiAgICBuID0gYXJyLmxlbmd0aC0xCiAgICBmb3IgaSBpbiAwLi5uLTEKICAgICAgICBpZiBhcnJbaV0gIT0gMAogICAgICAgICAgcHJpbnQgYXJyW2ldLCAiICIKICAgICAgICAgIGZvciBqIGluIGkgKyAxLi5uCiAgICAgICAgICAgICAgaWYgYXJyW2ldID09IGFycltqXQogICAgICAgICAgICAgICAgIGFycltqXSA9IDAKICAgICAgICAgICAgICBlbmQKICAgICAgICAgIGVuZAogICAgICAgIGVuZAogICAgZW5kCmVuZAptYWluCmRpc3RpbmN0KFtdKQo=