Given a string, reverse the order of words in the string.A word is defined as a sequence of non-space characters.You need to return a string that joins the words with a single space in the reversed order.Ensure to trim any leading or trailing spaces from the input before processing.