fixed bug that gave wrong answer

finally figured out how to only print maximum