longest prefix v2

Run Settings
LanguagePython
Language Version
Run Command
s = list(input().split(" ")) res = "" temp = s[0] for i in range(1,len(s)): for j in range(len(s[i])): try: if(s[i][j] == temp[j]): res += s[i][j] print(s,res) else: temp = res res = "" break except IndexError: continue # if(i == len(s)-1) : print(res,temp) temp = res res = ""
Editor Settings
Theme
Key bindings
Full width
Lines