-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestt.py
68 lines (54 loc) · 1.04 KB
/
testt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
s = 'ashley'
t = 'ash'
k = 2
n =''
startPopIndex = None
startInsIndex = None
startPop = 0
startIns = 0
space = 0
x = []
z = []
for letter in s:
x.append(letter)
for letter in t:
z.append(letter)
for index in range(len(x)):
if s == t:
k = 0
break
if x[index] != z[index]:
startPopIndex = x[index]
startInsIndex = z[index]
startPop = index
startIns = index
space = len(z) - (startIns + 1)
break
for index in range(startPop, len(x)):
if s == t:
k = 0
break
x.pop()
k -= 1
print(x)
print(k)
print(space)
if k == 0 and s != t:
break
if not x and space != k:
while space != k:
k -= 1
for index in range(startIns, len(z)):
if s == t:
k = 0
break
if k == 0 and s != t:
break
x.append(z[index])
k -= 1
print(x)
print(z)
if x == z or s == t and k == 0:
print('YES')
else:
print('NO')