Implemented code to reverse sequence of words in a given string