freq = {} while gets() for word in $_.split(' ') freq[word] +=1 end end printf("%d -- %d\n",10, freq[0])