Add #49 Ruby solution