words splitting and freq counter for luhn algorithm