[elixir] refactor word countto scan