Company: ZS_14oct
Difficulty: medium
Suffix-stripping Stemmer Problem Description A stemmer reduces each word to a base form. Implement a simple one that processes every word of a text independently with these two rules, applied in this order: Suffix removal: if the word ends in "ed" , "ly" or "ing" , remove that suffix. Truncation: if the word produced by rule 1 is longer than 8 letters, keep only its first 8 letters. Implement the function stemmer(text) , which takes a string of space-separated words and returns the same words, in the same order and separated by single spaces, each replaced by its stem. Input Format A single line containing text . Output Format Print a single line: the stemmed text. Constraints Every character in text is a lowercase English letter ( a - z ) or a space. text starts and ends with a letter, and no two consecutive characters are spaces. text contains between 1 and 100 words. No word is longer than 18 letters. No word is exactly ed , ly or ing , so every stem keeps at least one letter. (infe