Make this code compact
'''Write a program that takes in a string that contains a sentence, checks if the first letter of each word is the same as the last letter of the previous word. If the condition is met, output true, if not, output false. Casing does not matter. Sample Input: this string gets stuck Sample Output: true ''' string = input().split(" ") #print (string) list = [] for i in range(len(string)-1): letter = string[i][-1] if letter == string [i+1][0]: list.append("true") else: list.append("false") if all(i == "true" for i in list): print ("true") else: print ("false") I have already solved this codecoach challenge and the code I wrote has cleared all the tests. But I would love to see how you all write this code in a better way. As I am a newbie with no friends who code, This is only way I can see how other coders approach a problem. Thanks a lot!!