title: Print Words String Reverse Order
signature: string printWordsStringReverseOrder(string str) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(string actual, string expected){
      return actual == expected;
  }
  
  string driver(string str, string expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(str), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver("m Dm YZ", "YZ Dm m"); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver("65 48 57 71", "71 57 48 65"); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver("01 010", "010 01"); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver("mT vhByi", "vhByi mT"); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver("19 44 9 1", "1 9 44 19"); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver("0", "0"); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver("z vUi  ", "  vUi z"); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver("7 591 36643 9 055", "055 9 36643 591 7"); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver("01", "01"); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver("ti YGaijPY", "YGaijPY ti"); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }