use Set#add? to test and add in one shot
replace while-gets loop with IO::foreach()
drop blank lines to further shorten code
Merge pull request #1 from sunaku/patch-1

shorten using Set#add? and IO::foreach