You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# We can do the whole thing manually (without split()).
# Idea:
# initilialize two pointers, l and r.
# Move the right pointer as long as it's not pointing to the whitespace.
# If it finally points to the whitespace, we have a word. Take this word by using slicing, reverse it, and add to res.
# Move r and l. Now they point to the character after the whitespace (essentially, it's where the next word starts).
# Once the loop ends, we have the last word unproccessed.
# Need to add it manually.
# Add an extra space to res (because l always points to the first character of a word).
# Add the reversed word to res.
# Finally, res has one extra whitespace in the beginning. It appeared when we were appending the first word. But you can account for this in your return statement.