title: Print Words String Reverse Order
signature: function printWordsStringReverseOrder(str: string): string {
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;
  }
question_info.test_list: [{"idx": 0, "outputs": "YZ Dm m", "inputs": {"str": "m Dm YZ"}}, {"idx": 1, "outputs": "71 57 48 65", "inputs": {"str": "65 48 57 71"}}, {"idx": 2, "outputs": "010 01", "inputs": {"str": "01 010"}}, {"idx": 3, "outputs": "vhByi mT", "inputs": {"str": "mT vhByi"}}, {"idx": 4, "outputs": "1 9 44 19", "inputs": {"str": "19 44 9 1"}}, {"idx": 5, "outputs": "0", "inputs": {"str": "0"}}, {"idx": 6, "outputs": "  vUi z", "inputs": {"str": "z vUi  "}}, {"idx": 7, "outputs": "055 9 36643 591 7", "inputs": {"str": "7 591 36643 9 055"}}, {"idx": 8, "outputs": "01", "inputs": {"str": "01"}}, {"idx": 9, "outputs": "YGaijPY ti", "inputs": {"str": "ti YGaijPY"}}]
question_info.entry_cls_name: Solution
question_info.test_code: 
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function convertToString(value: any): string{
      return JSON.stringify(value, function (key, val) {
          if (val instanceof Set) {
              return Array.from(val);
          } return val;});
  }
  
  function validateSolution(actual: string, expected: string): boolean {
      return convertToString(actual) === convertToString(expected);
  }
  
  function driver(str: string, expected:string): string {
      try{
          if (validateSolution(PLACEHOLDER_FN_NAME(str),expected)){
              return "PASSED";
          }
          return "FAILED";
      } catch (error) {
        return error.name;
      }
      
  }
      
  function main(){
    let result = '';
    result = driver("m Dm YZ", "YZ Dm m");
    console.log(`TEST-0...${result}`);
  
    result = driver("65 48 57 71", "71 57 48 65");
    console.log(`TEST-1...${result}`);
  
    result = driver("01 010", "010 01");
    console.log(`TEST-2...${result}`);
  
    result = driver("mT vhByi", "vhByi mT");
    console.log(`TEST-3...${result}`);
  
    result = driver("19 44 9 1", "1 9 44 19");
    console.log(`TEST-4...${result}`);
  
    result = driver("0", "0");
    console.log(`TEST-5...${result}`);
  
    result = driver("z vUi  ", "  vUi z");
    console.log(`TEST-6...${result}`);
  
    result = driver("7 591 36643 9 055", "055 9 36643 591 7");
    console.log(`TEST-7...${result}`);
  
    result = driver("01", "01");
    console.log(`TEST-8...${result}`);
  
    result = driver("ti YGaijPY", "YGaijPY ti");
    console.log(`TEST-9...${result}`);
  
  };
  
  main();
question_info.extension: ts
question_info.entry_fn_name: printWordsStringReverseOrder
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: tsc --target es2020 --lib es5,dom,es2015,es2020 __FILENAME__
question_info.commands: node __FILENAME__.js