fixed problem 6 rightmost problem