輸入2個字符串,判斷其中一個字符串是不是以另外一個字符串結尾python
輸入2行,每行一個字符串數據code
若是第1個字符串以第2個字符串結尾,輸出第2個字符串 若是第2個字符串以第1個字符串結尾,輸出第1個字符串 若是兩個字符串互爲對方的結尾字符,輸出'all' 若是都不知足,輸出'no'blog
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")