len arr[] 1000
for n to 1000 - 1
   for m = n - 1 downto 1
      if arr[m] = arr[n]
         arr[n + 1] = n - m
         break 1
      .
   .
.
for i to 10
   write arr[i] & " "
.
print ""
for i = 991 to 1000
   write arr[i] & " "
.
