Finding the length and width of a rectangle