link : https://www.hackerrank.com/challenges/append-and-delete/problem
#!/bin/python3 from itertools import zip_longest s = input().strip() t = input().strip() k = int(input().strip()) output = 0 for idx, (i,j) in enumerate(zip_longest(s, t)): if i is None or j is None or i != j: output = len(s[idx:] + t[idx:]) break if k >= len(s+t): print('Yes') elif k >= output and (k - output) & 1 == 0: print('Yes') else: print('No')
댓글 없음:
댓글 쓰기