title: Converting One String Using Append Delete Last Operations
signature: class Solution {
  
      public bool ConvertingOneStringUsingAppendDeleteLastOperations(string str1, string str2, int k) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(bool actual, bool expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(string str1, string str2, int k, bool expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                bool pred_result = solution_cls.PLACEHOLDER_FN_NAME(str1, str2, k); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  "ZNHGro", "jAdbtDUYQu", 3, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  "382880806774", "65565", 10, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  "0", "00100010100", 2, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  "lxHTRFCTSQ", "sViXYE", 89, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  "6399914758", "780990121", 9, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  "01100011100000", "0100", 0, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  "WkGqlob", "NpQVdXzEtUZy", 6, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  "46974006151", "74438", 11, 
                  false
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  "1001001", "1000010", 15, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  "IJQ", "nFOHAeYEAp", 42, 
                  true
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  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;
  }