title: Converting One String Using Append Delete Last Operations
signature: bool convertingOneStringUsingAppendDeleteLastOperations(string str1, string str2, int k) {
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(bool actual, bool expected){
      return actual == expected;
  }
  
  string driver(string str1, string str2, int k, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(str1, str2, k), 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("ZNHGro", "jAdbtDUYQu", 3, false); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver("382880806774", "65565", 10, false); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver("0", "00100010100", 2, true); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver("lxHTRFCTSQ", "sViXYE", 89, true); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver("6399914758", "780990121", 9, true); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver("01100011100000", "0100", 0, true); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver("WkGqlob", "NpQVdXzEtUZy", 6, false); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver("46974006151", "74438", 11, false); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver("1001001", "1000010", 15, true); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver("IJQ", "nFOHAeYEAp", 42, true); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }