title: Print Words String Reverse Order
signature: function printWordsStringReverseOrder($str) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($str, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($str), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        "m Dm YZ", 
        "YZ Dm m"));
      
      printf("TEST-1...%s\n",driver(
        "65 48 57 71", 
        "71 57 48 65"));
      
      printf("TEST-2...%s\n",driver(
        "01 010", 
        "010 01"));
      
      printf("TEST-3...%s\n",driver(
        "mT vhByi", 
        "vhByi mT"));
      
      printf("TEST-4...%s\n",driver(
        "19 44 9 1", 
        "1 9 44 19"));
      
      printf("TEST-5...%s\n",driver(
        "0", 
        "0"));
      
      printf("TEST-6...%s\n",driver(
        "z vUi  ", 
        "  vUi z"));
      
      printf("TEST-7...%s\n",driver(
        "7 591 36643 9 055", 
        "055 9 36643 591 7"));
      
      printf("TEST-8...%s\n",driver(
        "01", 
        "01"));
      
      printf("TEST-9...%s\n",driver(
        "ti YGaijPY", 
        "YGaijPY ti"));
      
  }
  
  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;
  }