Truncate Sentence
Words in s are separated by single spaces. Return a string holding only the first k words of s, separated by single spaces.
Example 1
s "Hello how are you"
k 2
returns "Hello how"
The first two words are Hello how.
Constraints
1 <= len(s) <= 1001 <= k <=the number of words ins- No leading or trailing spaces
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.