title: Converting One String Using Append Delete Last Operations
signature: fun convertingOneStringUsingAppendDeleteLastOperations(str1: String, str2: String, k: Int): Boolean {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Boolean, expected:Boolean):Boolean{
    return actual.equals(expected)
  }
  fun driver(str1: String, str2: String, k: Int, expected:Boolean):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(str1, str2, k), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver("ZNHGro", "jAdbtDUYQu", 3, false)
      println("TEST-0...${result}")
      
      result = driver("382880806774", "65565", 10, false)
      println("TEST-1...${result}")
      
      result = driver("0", "00100010100", 2, true)
      println("TEST-2...${result}")
      
      result = driver("lxHTRFCTSQ", "sViXYE", 89, true)
      println("TEST-3...${result}")
      
      result = driver("6399914758", "780990121", 9, true)
      println("TEST-4...${result}")
      
      result = driver("01100011100000", "0100", 0, true)
      println("TEST-5...${result}")
      
      result = driver("WkGqlob", "NpQVdXzEtUZy", 6, false)
      println("TEST-6...${result}")
      
      result = driver("46974006151", "74438", 11, false)
      println("TEST-7...${result}")
      
      result = driver("1001001", "1000010", 15, true)
      println("TEST-8...${result}")
      
      result = driver("IJQ", "nFOHAeYEAp", 42, true)
      println("TEST-9...${result}")
      
          
  }
  
  main()
source_py: def converting_one_string_using_append_delete_last_operations(str1, str2, k):
      if ((len(str1) + len(str2)) < k):
          return True
      commonLength = 0
      for i in range(0, min(len(str1), len(str2)), 1):
          if (str1[i] == str2[i]):
              commonLength += 1
          else:
              break
      if (((((k - len(str1)) - len(str2)) + (2 * commonLength)) % 2) == 0):
          return True
      return False
source_cpp: bool converting_one_string_using_append_delete_last_operations(string str1, string str2, int k) {
    if ( ( str1 . length ( ) + str2 . length ( ) ) < k ) return true;
    int commonLength = 0;
    for ( int i = 0;
    i < min ( str1 . length ( ), str2 . length ( ) );
    i ++ ) {
      if ( str1 [ i ] == str2 [ i ] ) commonLength ++;
      else break;
    }
    if ( ( k - str1 . length ( ) - str2 . length ( ) + 2 * commonLength ) % 2 == 0 ) return true;
    return false;
  }