title: Print Words String Reverse Order
signature: function print_words_string_reverse_order(str)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(str, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(str), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("m Dm YZ", "YZ Dm m");
      @printf("TEST-0...%s\n",result);
      
      result = driver("65 48 57 71", "71 57 48 65");
      @printf("TEST-1...%s\n",result);
      
      result = driver("01 010", "010 01");
      @printf("TEST-2...%s\n",result);
      
      result = driver("mT vhByi", "vhByi mT");
      @printf("TEST-3...%s\n",result);
      
      result = driver("19 44 9 1", "1 9 44 19");
      @printf("TEST-4...%s\n",result);
      
      result = driver("0", "0");
      @printf("TEST-5...%s\n",result);
      
      result = driver("z vUi  ", "  vUi z");
      @printf("TEST-6...%s\n",result);
      
      result = driver("7 591 36643 9 055", "055 9 36643 591 7");
      @printf("TEST-7...%s\n",result);
      
      result = driver("01", "01");
      @printf("TEST-8...%s\n",result);
      
      result = driver("ti YGaijPY", "YGaijPY ti");
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
  }