prints the result
finalize(listname,length)