code: def reverseWords(self, s):
      # remove tail space
      s = s.strip(" ")
      array_s = []
      last = " "
      # remove multiple spaces
      for i in range(len(s)):
          if s[i] != " ":
              array_s.append(s[i])
          else:
              if last != " ":
                  array_s.append(s[i])
          last = s[i]
      array_s = array_s[::-1]
      ls, pos = len(array_s), 0
      for i in range(ls + 1):
          if i == ls or array_s[i] == " ":
              self.reverse(array_s, pos, i)
              pos = i + 1
      return "".join(array_s)
  
label_desc: Use image node_id 1 for calling the Solution obj's underlying member method code with example usage: obj.reverseWords(s) and returns: str