輸入2個字符串,判斷其中一個字符串是否是以另一個字符串結尾
輸入格式:
輸入2行,每行一個字符串數據
輸出格式:
如果第1個字符串以第2個字符串結尾,輸出第2個字符串 如果第2個字符串以第1個字符串結尾,輸出第1個字符串 如果兩個字符串互為對方的結尾字符,輸出'all' 如果都不滿足,輸出'no'
輸入樣例:
abc123
123
輸出樣例:
123
a=input()
b=input()
x=len(a)
y=len(b)
c=-len(a)
d=-len(b)
if x>y:
if a[d:]==b:
print(b)
else:
print("no")
elif x<y:
if a==b[c:]:
print(a)
else:
print("no")
elif x==y:
if a[c:]==b[c:]:
print("all")
else:
print("no")
