ie-npc = ei-npc = ie-pc = ei-pc = 0 for word of dict.toLowerCase!.match /\S+/g ++ie-npc if /(^|[^c])ie/.test word ++ei-npc if /(^|[^c])ei/.test word ++ie-pc if word.indexOf('cie') > -1 ++ei-pc if word.indexOf('cei') > -1 p1 = ie-npc > 2 * ei-npc p2 = ei-pc > 2 * ie-pc console.log '(1) is%s plausible.', if p1 then '' else ' not' console.log '(2) is%s plausible.', if p2 then '' else ' not' console.log 'The whole phrase is%s plausible.', if p1 and p2 then '' else ' not'