Write a method called smallWordFilter that, given a String containing words separated by single spaces
(" "), returns all the words in the original String that are 3 characters or shorter in the same order in
which they appeared in the original String, as an Array<String>.
For example, given the input "Xyz is the very best cat" you would return the Array<String> {"Xyz", "is", "the",
"cat"}.
We have skipped both "very" and "best" because they are longer than 3 characters.
This is a problem that would be much easier to solve using a list, since you don't know exactly how many part of
the input String are 3 characters or smaller!
But this can be done with an array, if somewhat awkwardly.
Here's a solution sketch to help you get started:
" "String that are 3 characters or smallerArray<String> of the appropriate size, initialized with empty StringsString parts filling your output array as you goWe've provided some starter code to help you get going on this problem.
Stuck? You may find these lessons helpful: