Write a Java program that reads a string and then strips off certain characters and words to produce a resultant string. The stripping is done in this manner: (i) remove from the end of each word the character(s): s, ed and ing (ii) remove all words with length 2 or less, including those words produced in (i) (iii) remove these words: the, had, has, have, was, were, are (iv) if a word is of length 3, include the word only if it has at least one vowel (v) for each word to be included in the resultant string, remove the letters e and u.
A sample run is given below: Enter text: The man has a dog and some cats. The dog runs. It is barking. The cats are playing while all these are happening. Output should be: man dog and som cat. dog rn. bark. cat play whil all ths happn
Aucun commentaire:
Enregistrer un commentaire