title: Print Words String Reverse Order
signature: class Solution {
  
      public String printWordsStringReverseOrder(String str) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str, String expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("m Dm YZ", "YZ Dm m");
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("65 48 57 71", "71 57 48 65");
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("01 010", "010 01");
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("mT vhByi", "vhByi mT");
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("19 44 9 1", "1 9 44 19");
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("0", "0");
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("z vUi  ", "  vUi z");
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("7 591 36643 9 055", "055 9 36643 591 7");
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("01", "01");
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("ti YGaijPY", "YGaijPY ti");
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str, String expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str),expected);
      }
      
      public boolean validateSolution(String actual, String expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
source_py: def print_words_string_reverse_order(str):
      i = (len(str) - 1)
      start = end = (i + 1)
      result = ''
      while (i >= 0):
          if (str[i] == ' '):
              start = (i + 1)
              while (start != end):
                  result += str[start]
                  start += 1
              result += ' '
              end = i
          i -= 1
      start = 0
      while (start != end):
          result += str[start]
          start += 1
      return result
source_cpp: string print_words_string_reverse_order(string str) {
    int i = str . length ( ) - 1;
    int start, end = i + 1;
    string result = "";
    while ( i >= 0 ) {
      if ( str [ i ] == ' ' ) {
        start = i + 1;
        while ( start != end ) result += str [ start ++ ];
        result += ' ';
        end = i;
      }
      i --;
    }
    start = 0;
    while ( start != end ) result += str [ start ++ ];
    return result;
  }