title: Print Words String Reverse Order
signature: fun 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.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:String, expected:String):Boolean{
    return actual.equals(expected)
  }
  fun driver(str: String, expected:String):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(str), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver("m Dm YZ", "YZ Dm m")
      println("TEST-0...${result}")
      
      result = driver("65 48 57 71", "71 57 48 65")
      println("TEST-1...${result}")
      
      result = driver("01 010", "010 01")
      println("TEST-2...${result}")
      
      result = driver("mT vhByi", "vhByi mT")
      println("TEST-3...${result}")
      
      result = driver("19 44 9 1", "1 9 44 19")
      println("TEST-4...${result}")
      
      result = driver("0", "0")
      println("TEST-5...${result}")
      
      result = driver("z vUi  ", "  vUi z")
      println("TEST-6...${result}")
      
      result = driver("7 591 36643 9 055", "055 9 36643 591 7")
      println("TEST-7...${result}")
      
      result = driver("01", "01")
      println("TEST-8...${result}")
      
      result = driver("ti YGaijPY", "YGaijPY ti")
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: printWordsStringReverseOrder
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn