Suppose Xiao Gang had X yuan. According to the conditions, a book is priced in 5 yuan. If Xiaohong buys this book, the ratio of its remaining money to Xiaogang is 2:5. Then Xiaohong has (2x/5)+5 yuan. According to Xiaogang, if he buys this book, the ratio of the remaining money to Xiaohong's money is 13 to 8, (x-5)/((2x/5+5))= 13/8, and x=37.5. So Xiaogang was originally 37.5 yuan, and Xiaohong was originally from 20 yuan.