Ruby: A script to take input and gives output (use of gets and puts)