problem 50. ugly