File size: 1,806 Bytes
cdf2a39 | 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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | ### Instruction: Given two programs which may not be written in same programming language, check if they both solve the same problem or not i.e. for any given input, would they both give the same output or not. Give the answer as either 'Yes' or 'No'.
### Input:
Program 1: x = input()
y = input()
z = ''
i = 0
while i < len(x):
if x[i] < y[i]:
print('-1')
exit(0)
else:
z = z + y[i]
i += 1
print(z)
Program 2: from sys import exit
x=str(input())
y=str(input())
for i in range(len(x)):
if x[i]<y[i]:
print(-1)
exit(0)
print(y)
### Response:
Yes
### Input:
Program 1: x = input()
y = input()
z = ''
i = 0
while i <= len(x):
if x[i] < y[i]:
print('-1')
exit(0)
else:
z = z + y[i]
i += 1
print(z)
Program 2: from sys import exit
x=str(input())
y=str(input())
for i in range(len(x)):
if x[i]<y[i]:
print(-1)
exit(0)
print(y)
### Response:
No
### Input:
Program 1: x = input()
y = input()
z = ''
i = 0
while i < len(x):
if x[i] < y[i]:
print('-1')
exit(0)
else:
z = z + y[i]
i -= 1
print(z)
Program 2: from sys import exit
x=str(input())
y=str(input())
for i in range(len(x)):
if x[i]<y[i]:
print(-1)
exit(0)
print(y)
### Response:
No
### Input:
Program 1: x = input()
y = input()
z = ''
for i in range(len(x)):
if x[i] < y[i]:
print("-1")
exit(0)
else:
z = z + y[i]
print(z)
Program 2: from sys import exit
x = str(input())
y = str(input())
i = 0
while i < len(x):
if x[i]<y[i]:
print(-1)
exit(0)
i += 1
print(y)
### Response:
Yes
### Input:
Program 1: |