Happy Horses Stable charges a flat rate of $12 to rent a horse plus $5 per hour. Charlie paid $37 to rent a horse. How many hours, x, did he pay to have the horse?

(ps. I know that s question was asked and answered by multiple people, but most of the answers people gave seemed incorrect)