title: Converting One String Using Append Delete Last Operations
signature: func convertingOneStringUsingAppendDeleteLastOperations(str1 string, str2 string, k int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(str1 string, str2 string, k int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(str1, str2, k),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver("ZNHGro", 
  	"jAdbtDUYQu", 
  	3, false)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver("382880806774", 
  	"65565", 
  	10, false)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver("0", 
  	"00100010100", 
  	2, true)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver("lxHTRFCTSQ", 
  	"sViXYE", 
  	89, true)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver("6399914758", 
  	"780990121", 
  	9, true)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver("01100011100000", 
  	"0100", 
  	0, true)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver("WkGqlob", 
  	"NpQVdXzEtUZy", 
  	6, false)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver("46974006151", 
  	"74438", 
  	11, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver("1001001", 
  	"1000010", 
  	15, true)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver("IJQ", 
  	"nFOHAeYEAp", 
  	42, true)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }