title: Converting One String Using Append Delete Last Operations
signature: class Solution {
  
      public Boolean convertingOneStringUsingAppendDeleteLastOperations(String str1, String str2, Integer k) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str1, String str2, Integer k, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str1, str2, k,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("ZNHGro", "jAdbtDUYQu", 3, false);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("382880806774", "65565", 10, false);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("0", "00100010100", 2, true);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("lxHTRFCTSQ", "sViXYE", 89, true);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("6399914758", "780990121", 9, true);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("01100011100000", "0100", 0, true);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("WkGqlob", "NpQVdXzEtUZy", 6, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("46974006151", "74438", 11, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("1001001", "1000010", 15, true);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("IJQ", "nFOHAeYEAp", 42, true);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str1, String str2, Integer k, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str1, str2, k),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
  }