The function applies the rule correctly for words that end in "s" but not for words that do not end in "s".