Answers for "append and delete hackerrank solution in python"

0

append and delete hackerrank solution in python

if __name__ == '__main__':
    s = input().strip()
    t = input().strip()
    k = int(input().strip())
    min_len = min(len(s), len(t))
    first_different_index = min_len

    for i in range(min_len):
        if s[i] != t[i]:
            first_different_index = i
            break

    necessary_operations = len(s) + len(t) - 2 * first_different_index

    print("Yes" if k == necessary_operations or (k >= necessary_operations and (k - necessary_operations) % 2 == 0 ) or k >= len(s) + len(t) else "No")
Posted by: Guest on November-04-2020

Code answers related to "append and delete hackerrank solution in python"

Python Answers by Framework

Browse Popular Code Answers by Language