This is an easy problem, iterate from end of string counting characters until we reach a space. I just wanted to make this post as a reminder to myself about creating a table of variable values when running through a test case before compiling/executing.
![](https://www.adamk.org/wp-content/uploads/2019/09/whiteboard-leetcode58-1024x768.jpg)
Alternative, more concise solution:
https://gist.github.com/adamkorg/eda4764ec11da3c3ce932e614636f224